This commit is contained in:
Yax 2022-04-27 03:04:55 +02:00
parent 325455439a
commit c75fa2f669
5 changed files with 19 additions and 17 deletions

View file

@ -8,25 +8,27 @@ cursor = connection.cursor()
# What script performs:
# - first, remove site table: crash here if table doesn't exist (compatibility test without effort)
# - remove site_id colum from comment table
# - remove site_id column from comment table
script = """
PRAGMA foreign_keys = OFF;
BEGIN TRANSACTION;
DROP TABLE site;
ALTER TABLE comment RENAME TO _comment_old;
CREATE TABLE comment (
id INTEGER NOT NULL PRIMARY KEY,
url VARCHAR(255) NOT NULL,
id INTEGER NOT NULL PRIMARY KEY,
url VARCHAR(255) NOT NULL,
notified DATETIME,
created DATETIME NOT NULL,
published DATETIME,
author_name VARCHAR(255) NOT NULL,
created DATETIME NOT NULL,
published DATETIME,
author_name VARCHAR(255) NOT NULL,
author_site VARCHAR(255) NOT NULL,
author_gravatar varchar(255),
content TEXT NOT NULL
content TEXT NOT NULL
);
INSERT INTO comment (id, url, notified, created, published, author_name, author_site, author_gravatar, content)
SELECT id, url, notified, created, published, author_name, author_site, author_gravatar, content
INSERT INTO comment (id, url, notified, created, published,
author_name, author_site, author_gravatar, content)
SELECT id, url, notified, created, published,
author_name, author_site, author_gravatar, content
FROM _comment_old;
DROP TABLE _comment_old;
COMMIT;