mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 19:14:23 +00:00
15 lines
440 B
PL/PgSQL
15 lines
440 B
PL/PgSQL
BEGIN;
|
|
-- create table with empty created_at
|
|
ALTER TABLE eventstore.events ADD COLUMN created_at TIMESTAMPTZ DEFAULT NULL;
|
|
COMMIT;
|
|
|
|
BEGIN;
|
|
-- backfill created_at
|
|
UPDATE eventstore.events SET created_at = creation_date WHERE created_at IS NULL;
|
|
COMMIT;
|
|
|
|
BEGIN;
|
|
-- set column rules
|
|
ALTER TABLE eventstore.events ALTER COLUMN created_at SET DEFAULT clock_timestamp();
|
|
ALTER TABLE eventstore.events ALTER COLUMN created_at SET NOT NULL;
|
|
COMMIT; |