feature: add creation dates
This commit is contained in:
@ -0,0 +1,4 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- alter table "public"."person" add column "created_at" timestamptz
|
||||
-- null default now();
|
||||
@ -0,0 +1,2 @@
|
||||
alter table "public"."person" add column "created_at" timestamptz
|
||||
null default now();
|
||||
@ -0,0 +1,21 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- alter table "public"."person" add column "updated_at" timestamptz
|
||||
-- null default now();
|
||||
--
|
||||
-- CREATE OR REPLACE FUNCTION "public"."set_current_timestamp_updated_at"()
|
||||
-- RETURNS TRIGGER AS $$
|
||||
-- DECLARE
|
||||
-- _new record;
|
||||
-- BEGIN
|
||||
-- _new := NEW;
|
||||
-- _new."updated_at" = NOW();
|
||||
-- RETURN _new;
|
||||
-- END;
|
||||
-- $$ LANGUAGE plpgsql;
|
||||
-- CREATE TRIGGER "set_public_person_updated_at"
|
||||
-- BEFORE UPDATE ON "public"."person"
|
||||
-- FOR EACH ROW
|
||||
-- EXECUTE PROCEDURE "public"."set_current_timestamp_updated_at"();
|
||||
-- COMMENT ON TRIGGER "set_public_person_updated_at" ON "public"."person"
|
||||
-- IS 'trigger to set value of column "updated_at" to current timestamp on row update';
|
||||
@ -0,0 +1,19 @@
|
||||
alter table "public"."person" add column "updated_at" timestamptz
|
||||
null default now();
|
||||
|
||||
CREATE OR REPLACE FUNCTION "public"."set_current_timestamp_updated_at"()
|
||||
RETURNS TRIGGER AS $$
|
||||
DECLARE
|
||||
_new record;
|
||||
BEGIN
|
||||
_new := NEW;
|
||||
_new."updated_at" = NOW();
|
||||
RETURN _new;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
CREATE TRIGGER "set_public_person_updated_at"
|
||||
BEFORE UPDATE ON "public"."person"
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE "public"."set_current_timestamp_updated_at"();
|
||||
COMMENT ON TRIGGER "set_public_person_updated_at" ON "public"."person"
|
||||
IS 'trigger to set value of column "updated_at" to current timestamp on row update';
|
||||
@ -0,0 +1,4 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- alter table "public"."company" add column "created_at" timestamptz
|
||||
-- null default now();
|
||||
@ -0,0 +1,2 @@
|
||||
alter table "public"."company" add column "created_at" timestamptz
|
||||
null default now();
|
||||
@ -0,0 +1,21 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- alter table "public"."company" add column "updated_at" timestamptz
|
||||
-- not null default now();
|
||||
--
|
||||
-- CREATE OR REPLACE FUNCTION "public"."set_current_timestamp_updated_at"()
|
||||
-- RETURNS TRIGGER AS $$
|
||||
-- DECLARE
|
||||
-- _new record;
|
||||
-- BEGIN
|
||||
-- _new := NEW;
|
||||
-- _new."updated_at" = NOW();
|
||||
-- RETURN _new;
|
||||
-- END;
|
||||
-- $$ LANGUAGE plpgsql;
|
||||
-- CREATE TRIGGER "set_public_company_updated_at"
|
||||
-- BEFORE UPDATE ON "public"."company"
|
||||
-- FOR EACH ROW
|
||||
-- EXECUTE PROCEDURE "public"."set_current_timestamp_updated_at"();
|
||||
-- COMMENT ON TRIGGER "set_public_company_updated_at" ON "public"."company"
|
||||
-- IS 'trigger to set value of column "updated_at" to current timestamp on row update';
|
||||
@ -0,0 +1,19 @@
|
||||
alter table "public"."company" add column "updated_at" timestamptz
|
||||
not null default now();
|
||||
|
||||
CREATE OR REPLACE FUNCTION "public"."set_current_timestamp_updated_at"()
|
||||
RETURNS TRIGGER AS $$
|
||||
DECLARE
|
||||
_new record;
|
||||
BEGIN
|
||||
_new := NEW;
|
||||
_new."updated_at" = NOW();
|
||||
RETURN _new;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
CREATE TRIGGER "set_public_company_updated_at"
|
||||
BEFORE UPDATE ON "public"."company"
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE "public"."set_current_timestamp_updated_at"();
|
||||
COMMENT ON TRIGGER "set_public_company_updated_at" ON "public"."company"
|
||||
IS 'trigger to set value of column "updated_at" to current timestamp on row update';
|
||||
@ -0,0 +1 @@
|
||||
alter table "public"."company" alter column "created_at" drop not null;
|
||||
@ -0,0 +1 @@
|
||||
alter table "public"."company" alter column "created_at" set not null;
|
||||
@ -0,0 +1 @@
|
||||
alter table "public"."person" alter column "created_at" drop not null;
|
||||
@ -0,0 +1 @@
|
||||
alter table "public"."person" alter column "created_at" set not null;
|
||||
@ -0,0 +1 @@
|
||||
alter table "public"."person" alter column "updated_at" drop not null;
|
||||
@ -0,0 +1 @@
|
||||
alter table "public"."person" alter column "updated_at" set not null;
|
||||
@ -0,0 +1,4 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- alter table "public"."workspaces" add column "created_at" timestamptz
|
||||
-- not null default now();
|
||||
@ -0,0 +1,2 @@
|
||||
alter table "public"."workspaces" add column "created_at" timestamptz
|
||||
not null default now();
|
||||
@ -0,0 +1,21 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- alter table "public"."workspaces" add column "updated_at" timestamptz
|
||||
-- not null default now();
|
||||
--
|
||||
-- CREATE OR REPLACE FUNCTION "public"."set_current_timestamp_updated_at"()
|
||||
-- RETURNS TRIGGER AS $$
|
||||
-- DECLARE
|
||||
-- _new record;
|
||||
-- BEGIN
|
||||
-- _new := NEW;
|
||||
-- _new."updated_at" = NOW();
|
||||
-- RETURN _new;
|
||||
-- END;
|
||||
-- $$ LANGUAGE plpgsql;
|
||||
-- CREATE TRIGGER "set_public_workspaces_updated_at"
|
||||
-- BEFORE UPDATE ON "public"."workspaces"
|
||||
-- FOR EACH ROW
|
||||
-- EXECUTE PROCEDURE "public"."set_current_timestamp_updated_at"();
|
||||
-- COMMENT ON TRIGGER "set_public_workspaces_updated_at" ON "public"."workspaces"
|
||||
-- IS 'trigger to set value of column "updated_at" to current timestamp on row update';
|
||||
@ -0,0 +1,19 @@
|
||||
alter table "public"."workspaces" add column "updated_at" timestamptz
|
||||
not null default now();
|
||||
|
||||
CREATE OR REPLACE FUNCTION "public"."set_current_timestamp_updated_at"()
|
||||
RETURNS TRIGGER AS $$
|
||||
DECLARE
|
||||
_new record;
|
||||
BEGIN
|
||||
_new := NEW;
|
||||
_new."updated_at" = NOW();
|
||||
RETURN _new;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
CREATE TRIGGER "set_public_workspaces_updated_at"
|
||||
BEFORE UPDATE ON "public"."workspaces"
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE "public"."set_current_timestamp_updated_at"();
|
||||
COMMENT ON TRIGGER "set_public_workspaces_updated_at" ON "public"."workspaces"
|
||||
IS 'trigger to set value of column "updated_at" to current timestamp on row update';
|
||||
Reference in New Issue
Block a user