mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
refactor: store migrator
This commit is contained in:
15
store/migration/postgres/prod/0.19/00__add_resource_name.sql
Normal file
15
store/migration/postgres/prod/0.19/00__add_resource_name.sql
Normal file
@@ -0,0 +1,15 @@
|
||||
ALTER TABLE memo ADD COLUMN resource_name TEXT;
|
||||
|
||||
UPDATE memo SET resource_name = uuid_in(md5(random()::text || random()::text)::cstring);
|
||||
|
||||
ALTER TABLE memo ALTER COLUMN resource_name SET NOT NULL;
|
||||
|
||||
CREATE UNIQUE INDEX idx_memo_resource_name ON memo (resource_name);
|
||||
|
||||
ALTER TABLE resource ADD COLUMN resource_name TEXT;
|
||||
|
||||
UPDATE resource SET resource_name = uuid_in(md5(random()::text || random()::text)::cstring);
|
||||
|
||||
ALTER TABLE resource ALTER COLUMN resource_name SET NOT NULL;
|
||||
|
||||
CREATE UNIQUE INDEX idx_resource_resource_name ON resource (resource_name);
|
Reference in New Issue
Block a user