2019-12-20 00:09:10 +00:00
|
|
|
.timeout 30000
|
|
|
|
|
|
|
|
PRAGMA FOREIGN_KEYS=OFF;
|
|
|
|
|
|
|
|
BEGIN TRANSACTION;
|
|
|
|
|
|
|
|
ALTER TABLE "group" RENAME TO "group__";
|
|
|
|
|
|
|
|
CREATE TABLE "group"
|
|
|
|
(
|
|
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
|
|
enabled BOOLEAN NOT NULL DEFAULT 1,
|
|
|
|
name TEXT UNIQUE NOT NULL,
|
2019-12-20 00:14:58 +00:00
|
|
|
date_added INTEGER NOT NULL DEFAULT (cast(strftime('%s', 'now') as int)),
|
|
|
|
date_modified INTEGER NOT NULL DEFAULT (cast(strftime('%s', 'now') as int)),
|
2019-12-20 00:09:10 +00:00
|
|
|
description TEXT
|
|
|
|
);
|
|
|
|
|
2019-12-20 00:14:58 +00:00
|
|
|
CREATE TRIGGER tr_group_update AFTER UPDATE ON "group"
|
|
|
|
BEGIN
|
|
|
|
UPDATE "group" SET date_modified = (cast(strftime('%s', 'now') as int)) WHERE id = NEW.id;
|
|
|
|
END;
|
|
|
|
|
2019-12-29 20:35:11 +00:00
|
|
|
INSERT OR IGNORE INTO "group" (id,enabled,name,description) SELECT id,enabled,name,description FROM "group__";
|
|
|
|
|
|
|
|
DROP TABLE "group__";
|
|
|
|
|
2019-12-20 00:42:59 +00:00
|
|
|
CREATE TRIGGER tr_group_zero AFTER DELETE ON "group"
|
|
|
|
BEGIN
|
|
|
|
INSERT OR IGNORE INTO "group" (id,enabled,name) VALUES (0,1,'Unassociated');
|
|
|
|
END;
|
|
|
|
|
2019-12-20 00:09:10 +00:00
|
|
|
UPDATE info SET value = 8 WHERE property = 'version';
|
|
|
|
|
|
|
|
COMMIT;
|