PRAGMA foreign_keys=OFF;
PRAGMA legacy_alter_table=ON;
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 TABLE photos_;
PRAGMA foreign_keys=ON;
PRAGMA legacy_alter_table=OFF;
