Updated migration
Signed-off-by: James Ketrenos <james_gitlab@ketrenos.com>
This commit is contained in:
parent
0afbd32cbb
commit
1e493198cf
18
migration
18
migration
@ -1,10 +1,10 @@
|
|||||||
cat << EOF | ./query.sh
|
PRAGMA foreign_keys=OFF;
|
||||||
pragma foreign_keys=off;
|
PRAGMA legacy_alter_table=ON;
|
||||||
begin transaction;
|
BEGIN TRANSACTION;
|
||||||
alter table photos rename to photos_;
|
ALTER TABLES 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);
|
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_;
|
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;
|
COMMIT;
|
||||||
drop photos_;
|
DROP TABLE photos_;
|
||||||
pragma foreign_keys=on;
|
PRAGMA foreign_keys=ON;
|
||||||
EOF
|
PRAGMA legacy_alter_table=OFF;
|
||||||
|
@ -173,6 +173,7 @@ require("./db/photos").then(function(db) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
|
console.log(error);
|
||||||
console.warn("Skipping out on image " + photoPath + " and marking to 0 faces to prevent future scanning.");
|
console.warn("Skipping out on image " + photoPath + " and marking to 0 faces to prevent future scanning.");
|
||||||
return photoDB.sequelize.query("UPDATE photos SET faces=:faces WHERE id=:id", {
|
return photoDB.sequelize.query("UPDATE photos SET faces=:faces WHERE id=:id", {
|
||||||
replacements: {
|
replacements: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user