default values are bad practice

master
b3yond 2018-09-09 20:28:13 +02:00
parent b80fa78a17
commit 120030460e
2 changed files with 6 additions and 6 deletions

8
db.py
View File

@ -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)

View File

@ -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