Skip to content

Commit

Permalink
update: adds migrations alter for created and updater at fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Edmartt committed Sep 30, 2024
1 parent 8b43e09 commit 1b11cfd
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions migrations/postgres/20240930090611-add-created-updated-field.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@

-- +migrate Up
ALTER TABLE branch
ADD created_at timestamp with time zone DEFAULT now() NOT NULL,
ADD updated_at timestamp with time zone DEFAULT now() NOT NULL;

ALTER TABLE campaign
ADD created_at timestamp with time zone DEFAULT now() NOT NULL,
ADD updated_at timestamp with time zone DEFAULT now() NOT NULL;

ALTER TABLE commerce
ADD created_at timestamp with time zone DEFAULT now() NOT NULL,
ADD updated_at timestamp with time zone DEFAULT now() NOT NULL;

ALTER TABLE customer
ADD created_at timestamp with time zone DEFAULT now() NOT NULL,
ADD updated_at timestamp with time zone DEFAULT now() NOT NULL;

ALTER TABLE purchase
ADD created_at timestamp with time zone DEFAULT now() NOT NULL,
ADD updated_at timestamp with time zone DEFAULT now() NOT NULL;

ALTER TABLE reward
ADD created_at timestamp with time zone DEFAULT now() NOT NULL,
ADD updated_at timestamp with time zone DEFAULT now() NOT NULL;


-- +migrate Down

ALTER TABLE branch
DROP COLUMN created_at,
DROP COLUMN updated_at;

ALTER TABLE campaign
DROP COLUMN created_at,
DROP COLUMN updated_at;

ALTER TABLE commerce
DROP COLUMN created_at,
DROP COLUMN updated_at;

ALTER TABLE customer
DROP COLUMN created_at,
DROP COLUMN updated_at;

ALTER TABLE purchase
DROP COLUMN created_at,
DROP COLUMN updated_at;

ALTER TABLE reward
DROP COLUMN created_at,
DROP COLUMN updated_at;

0 comments on commit 1b11cfd

Please sign in to comment.