mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Merge pull request #2904 from omnivore-app/fix/highlight-date
add default value = now() to updatedAt field in labels, user_profile and highlight tables
This commit is contained in:
commit
00b33b647f
2 changed files with 35 additions and 0 deletions
22
packages/db/migrations/0131.do.add_default_value_to_updated_at.sql
Executable file
22
packages/db/migrations/0131.do.add_default_value_to_updated_at.sql
Executable file
|
|
@ -0,0 +1,22 @@
|
|||
-- Type: DO
|
||||
-- Name: add_default_value_to_updated_at
|
||||
-- Description: Add default = now() to updated_at field in profile, labels and highlight table
|
||||
|
||||
BEGIN;
|
||||
|
||||
UPDATE omnivore.user_profile SET updated_at = created_at WHERE updated_at IS NULL;
|
||||
ALTER TABLE omnivore.user_profile
|
||||
ALTER COLUMN updated_at SET DEFAULT current_timestamp,
|
||||
ALTER COLUMN updated_at SET NOT NULL;
|
||||
|
||||
UPDATE omnivore.labels SET updated_at = created_at WHERE updated_at IS NULL;
|
||||
ALTER TABLE omnivore.labels
|
||||
ALTER COLUMN updated_at SET DEFAULT current_timestamp,
|
||||
ALTER COLUMN updated_at SET NOT NULL;
|
||||
|
||||
UPDATE omnivore.highlight SET updated_at = created_at WHERE updated_at IS NULL;
|
||||
ALTER TABLE omnivore.highlight
|
||||
ALTER COLUMN updated_at SET DEFAULT current_timestamp,
|
||||
ALTER COLUMN updated_at SET NOT NULL;
|
||||
|
||||
COMMIT;
|
||||
13
packages/db/migrations/0131.undo.add_default_value_to_updated_at.sql
Executable file
13
packages/db/migrations/0131.undo.add_default_value_to_updated_at.sql
Executable file
|
|
@ -0,0 +1,13 @@
|
|||
-- Type: UNDO
|
||||
-- Name: add_default_value_to_updated_at
|
||||
-- Description: Add default = now() to updated_at field in profile, labels and highlight table
|
||||
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE omnivore.user_profile ALTER COLUMN updated_at DROP NOT NULL;
|
||||
|
||||
ALTER TABLE omnivore.labels ALTER COLUMN updated_at DROP NOT NULL;
|
||||
|
||||
ALTER TABLE omnivore.highlight ALTER COLUMN updated_at DROP NOT NULL;
|
||||
|
||||
COMMIT;
|
||||
Loading…
Reference in a new issue