rpiwebapp-public/update_tables.sql

29 lines
676 B
MySQL
Raw Normal View History

.print "start alter table"
ALTER TABLE comic_thumbnails RENAME TO old_comic_thumbnails;
.print "finish alter table"
.print ""
.print "start create new table"
CREATE TABLE IF NOT EXISTS "comic_thumbnails" (
"comic_id" INTEGER,
"pageNumber" INTEGER,
"image" BLOB,
"type" TEXT,
"id" INTEGER PRIMARY KEY AUTOINCREMENT
);
.print "finish create new table"
.print ""
.print "start copy from old table"
INSERT INTO comic_thumbnails(comic_id, pageNumber, image, type)
SELECT id, pageNumber, image, type FROM old_comic_thumbnails;
.print "finish copy from old table"
.print ""
.print "start delete old table"
DROP TABLE old_comic_thumbnails;
.print "finish delete old table"