From c8d7e391a07ae546769b16b5897740398445fbf9 Mon Sep 17 00:00:00 2001 From: Lynne Date: Wed, 14 Aug 2019 15:10:53 +1000 Subject: [PATCH] add sort id if it doesn't exist --- main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index b270a11..8aa62be 100755 --- a/main.py +++ b/main.py @@ -77,9 +77,9 @@ following = client.account_following(me.id) db = sqlite3.connect("toots.db") db.text_factory=str c = db.cursor() -c.execute("CREATE TABLE IF NOT EXISTS `toots` (id INT NOT NULL UNIQUE PRIMARY KEY, cw INT NOT NULL DEFAULT 0, userid INT NOT NULL, uri VARCHAR NOT NULL, content VARCHAR NOT NULL) WITHOUT ROWID") +c.execute("CREATE TABLE IF NOT EXISTS `toots` (sortid INT NOT NULL, id VARCHAR NOT NULL UNIQUE PRIMARY KEY, cw INT NOT NULL DEFAULT 0, userid VARCHAR NOT NULL, uri VARCHAR NOT NULL, content VARCHAR NOT NULL) WITHOUT ROWID") try: - c.execute("ALTER TABLE `toots` ADD COLUMN cw INT NOT NULL DEFAULT 0") + c.execute("ALTER TABLE `toots` ADD COLUMN sortid INT NOT NULL") except: pass # column already exists db.commit()