This commit is contained in:
Yax 2022-04-26 20:51:42 +02:00
parent 5a286fa0d2
commit 325455439a
18 changed files with 261 additions and 459 deletions

View file

@ -9,16 +9,16 @@ cursor = connection.cursor()
script = """
CREATE TABLE comment (
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,
author_site VARCHAR(255) NOT NULL,
author_gravatar varchar(255),
content TEXT NOT NULL
url VARCHAR(255) NOT NULL,
notified DATETIME,
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
, ulid INTEGER);
"""
cursor.executescript(script)
connection.close()
connection.close()

View file

@ -6,7 +6,7 @@ import sqlite3
connection = sqlite3.connect("db.sqlite")
cursor = connection.cursor()
# What script performs:
# 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
script = """
@ -16,14 +16,14 @@ DROP TABLE site;
ALTER TABLE comment RENAME TO _comment_old;
CREATE TABLE comment (
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,
author_site VARCHAR(255) NOT NULL,
author_gravatar varchar(255),
content TEXT NOT NULL
url VARCHAR(255) NOT NULL,
notified DATETIME,
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
);
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
@ -34,4 +34,4 @@ PRAGMA foreign_keys = ON;
"""
cursor.executescript(script)
connection.close()
connection.close()