mirror of
https://github.com/usememos/memos.git
synced 2024-12-19 09:02:49 +03:00
fix: create triggers after dropping old tables
This commit is contained in:
parent
ffe145d436
commit
269d92e637
@ -19,6 +19,10 @@ CREATE TABLE user (
|
|||||||
|
|
||||||
INSERT INTO user SELECT * FROM _user_old;
|
INSERT INTO user SELECT * FROM _user_old;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS _user_old;
|
||||||
|
|
||||||
|
DROP TRIGGER IF EXISTS `trigger_update_user_modification_time`;
|
||||||
|
|
||||||
CREATE TRIGGER IF NOT EXISTS `trigger_update_user_modification_time`
|
CREATE TRIGGER IF NOT EXISTS `trigger_update_user_modification_time`
|
||||||
AFTER
|
AFTER
|
||||||
UPDATE
|
UPDATE
|
||||||
@ -31,8 +35,6 @@ WHERE
|
|||||||
rowid = old.rowid;
|
rowid = old.rowid;
|
||||||
END;
|
END;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS _user_old;
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS _memo_old;
|
DROP TABLE IF EXISTS _memo_old;
|
||||||
|
|
||||||
ALTER TABLE memo RENAME TO _memo_old;
|
ALTER TABLE memo RENAME TO _memo_old;
|
||||||
@ -51,6 +53,10 @@ CREATE TABLE memo (
|
|||||||
|
|
||||||
INSERT INTO memo SELECT * FROM _memo_old;
|
INSERT INTO memo SELECT * FROM _memo_old;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS _memo_old;
|
||||||
|
|
||||||
|
DROP TRIGGER IF EXISTS `trigger_update_memo_modification_time`;
|
||||||
|
|
||||||
CREATE TRIGGER IF NOT EXISTS `trigger_update_memo_modification_time`
|
CREATE TRIGGER IF NOT EXISTS `trigger_update_memo_modification_time`
|
||||||
AFTER
|
AFTER
|
||||||
UPDATE
|
UPDATE
|
||||||
@ -63,8 +69,6 @@ WHERE
|
|||||||
rowid = old.rowid;
|
rowid = old.rowid;
|
||||||
END;
|
END;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS _memo_old;
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS _memo_organizer_old;
|
DROP TABLE IF EXISTS _memo_organizer_old;
|
||||||
|
|
||||||
ALTER TABLE memo_organizer RENAME TO _memo_organizer_old;
|
ALTER TABLE memo_organizer RENAME TO _memo_organizer_old;
|
||||||
@ -102,6 +106,10 @@ CREATE TABLE shortcut (
|
|||||||
|
|
||||||
INSERT INTO shortcut SELECT * FROM _shortcut_old;
|
INSERT INTO shortcut SELECT * FROM _shortcut_old;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS _shortcut_old;
|
||||||
|
|
||||||
|
DROP TRIGGER IF EXISTS `trigger_update_shortcut_modification_time`;
|
||||||
|
|
||||||
CREATE TRIGGER IF NOT EXISTS `trigger_update_shortcut_modification_time`
|
CREATE TRIGGER IF NOT EXISTS `trigger_update_shortcut_modification_time`
|
||||||
AFTER
|
AFTER
|
||||||
UPDATE
|
UPDATE
|
||||||
@ -114,8 +122,6 @@ WHERE
|
|||||||
rowid = old.rowid;
|
rowid = old.rowid;
|
||||||
END;
|
END;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS _shortcut_old;
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS _resource_old;
|
DROP TABLE IF EXISTS _resource_old;
|
||||||
|
|
||||||
ALTER TABLE resource RENAME TO _resource_old;
|
ALTER TABLE resource RENAME TO _resource_old;
|
||||||
@ -135,6 +141,10 @@ CREATE TABLE resource (
|
|||||||
|
|
||||||
INSERT INTO resource SELECT * FROM _resource_old;
|
INSERT INTO resource SELECT * FROM _resource_old;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS _resource_old;
|
||||||
|
|
||||||
|
DROP TRIGGER IF EXISTS `trigger_update_resource_modification_time`;
|
||||||
|
|
||||||
CREATE TRIGGER IF NOT EXISTS `trigger_update_resource_modification_time`
|
CREATE TRIGGER IF NOT EXISTS `trigger_update_resource_modification_time`
|
||||||
AFTER
|
AFTER
|
||||||
UPDATE
|
UPDATE
|
||||||
@ -147,8 +157,6 @@ WHERE
|
|||||||
rowid = old.rowid;
|
rowid = old.rowid;
|
||||||
END;
|
END;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS _resource_old;
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS _user_setting_old;
|
DROP TABLE IF EXISTS _user_setting_old;
|
||||||
|
|
||||||
ALTER TABLE user_setting RENAME TO _user_setting_old;
|
ALTER TABLE user_setting RENAME TO _user_setting_old;
|
||||||
|
Loading…
Reference in New Issue
Block a user