From faaf8ac5f427cfc9471c23d73aa8ba93becf4978 Mon Sep 17 00:00:00 2001 From: b3yond Date: Sun, 9 Sep 2018 20:28:13 +0200 Subject: [PATCH] default values are bad practice --- db.py | 8 ++++---- user.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/db.py b/db.py index dd3a695..7eb938b 100644 --- a/db.py +++ b/db.py @@ -67,10 +67,10 @@ class DB(object): FOREIGN KEY(instance_id) REFERENCES mastodon_instances(id) ); CREATE TABLE IF NOT EXISTS seen_toots ( - id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE DEFAULT 1, - user_id INTEGER DEFAULT 1, - mastodon_accounts_id INTEGER DEFAULT 1, - toot_id INTEGER DEFAULT 0, + id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE, + user_id INTEGER, + mastodon_accounts_id INTEGER, + toot_id INTEGER, FOREIGN KEY(user_id) REFERENCES user(id), FOREIGN KEY(mastodon_accounts_id) REFERENCES mastodon_accounts(id) diff --git a/user.py b/user.py index 49b4aef..2e1a550 100644 --- a/user.py +++ b/user.py @@ -158,8 +158,8 @@ schlitz db.execute("SELECT id FROM mastodon_instances WHERE instance = ?;", (instance_url,)) masto_instance = db.cur.fetchone()[0] - db.execute("INSERT INTO seen_toots (user_id, mastodon_accounts_id) VALUES (?,?);", - (self.uid, masto_instance)) + db.execute("INSERT INTO seen_toots (user_id, mastodon_accounts_id, toot_id) VALUES (?,?,?);", + (self.uid, masto_instance, 0)) db.conn.commit() return