From 0afbd32cbbfaae309edee1f087714b644262f5ea Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Sun, 5 Jan 2020 21:18:27 -0800 Subject: [PATCH] Updated migration Signed-off-by: James Ketrenos --- migration | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/migration b/migration index 45a719c..7da2de7 100644 --- a/migration +++ b/migration @@ -1 +1,10 @@ -echo "alter table faces add column lastComparedId INTEGER;" | ./query.sh +cat << EOF | ./query.sh +pragma foreign_keys=off; +begin transaction; +alter table photos rename to photos_; +CREATE TABLE `photos` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `name` VARCHAR(255), `filename` VARCHAR(255), `added` DATETIME, `modified` DATETIME, `updated` DATETIME, `scanned` DATETIME, `taken` DATETIME, `width` INTEGER, `height` INTEGER, `size` INTEGER, `duplicate` TINYINT(1) DEFAULT 0, `deleted` TINYINT(1) DEFAULT 0, `albumId` INTEGER REFERENCES `albums` (`id`), `faces` INTEGER DEFAULT -1); +insert into photos (id,name,filename,added,modified,updated,scanned,taken,width,height,size,duplicate,deleted,albumId,faces) select id,name,filename,added,modified,updated,scanned,taken,width,height,size,duplicate,deleted,albumId,faces from photos_; +commit; +drop photos_; +pragma foreign_keys=on; +EOF