mirror of
https://github.com/usememos/memos.git
synced 2024-11-10 08:52:22 +08:00
fix: postgres upgrade script
This commit is contained in:
parent
087f60ba7b
commit
29a22914cf
1 changed files with 7 additions and 12 deletions
|
@ -1,16 +1,11 @@
|
|||
ALTER TABLE `resource`
|
||||
ADD COLUMN `storage_type` VARCHAR(256) NOT NULL DEFAULT '',
|
||||
ADD COLUMN `reference` VARCHAR(256) NOT NULL DEFAULT '',
|
||||
ADD COLUMN `payload` TEXT NOT NULL;
|
||||
ALTER TABLE resource ADD COLUMN storage_type TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE resource ADD COLUMN reference TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE resource ADD COLUMN payload TEXT NOT NULL DEFAULT '{}';
|
||||
|
||||
UPDATE `resource`
|
||||
SET `storage_type` = 'LOCAL', `reference` = `internal_path`
|
||||
WHERE `internal_path` IS NOT NULL AND `internal_path` != '';
|
||||
UPDATE resource SET storage_type = 'LOCAL', reference = internal_path WHERE internal_path IS NOT NULL AND internal_path != '';
|
||||
|
||||
UPDATE `resource`
|
||||
SET `storage_type` = 'EXTERNAL', `reference` = `external_link`
|
||||
WHERE `external_link` IS NOT NULL AND `external_link` != '';
|
||||
UPDATE resource SET storage_type = 'EXTERNAL', reference = external_link WHERE external_link IS NOT NULL AND external_link != '';
|
||||
|
||||
ALTER TABLE `resource` DROP COLUMN `internal_path`;
|
||||
ALTER TABLE resource DROP COLUMN internal_path;
|
||||
|
||||
ALTER TABLE `resource` DROP COLUMN `external_link`;
|
||||
ALTER TABLE resource DROP COLUMN external_link;
|
||||
|
|
Loading…
Reference in a new issue