Skip to content

Commit 80e3bac

Browse files
committed
migration script complete
1 parent 8ba0287 commit 80e3bac

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

migration.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ ALTER TABLE pastes DROP COLUMN IF EXISTS last_edited CASCADE; -- no longer allow
66
ALTER TABLE pastes ALTER COLUMN password SET DEFAULT NULL; -- nullable password by default
77
ALTER TABLE pastes DROP COLUMN IF EXISTS origin_ip CASCADE; -- no longer needed
88
ALTER TABLE pastes ADD COLUMN IF NOT EXISTS safety TEXT UNIQUE; -- this is how we handle paste deletion.
9+
UPDATE pastes SET safety = SELECT gen_random_uuid(); -- Populate with junk data.
10+
ALTER TABLE pastes ALTER COLUMN safety SET NOT NULL; -- add not null constraint
911
CREATE UNIQUE INDEX IF NOT EXISTS pastes_safety_idx ON pastes (safety); -- -- Index by safety keys for faster lookup to delete.
1012

1113
SAVEPOINT files;

0 commit comments

Comments
 (0)