default values are bad practice

This commit is contained in:
b3yond 2018-09-09 20:28:13 +02:00
parent a54538bcea
commit faaf8ac5f4
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) FOREIGN KEY(instance_id) REFERENCES mastodon_instances(id)
); );
CREATE TABLE IF NOT EXISTS seen_toots ( CREATE TABLE IF NOT EXISTS seen_toots (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE DEFAULT 1, id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE,
user_id INTEGER DEFAULT 1, user_id INTEGER,
mastodon_accounts_id INTEGER DEFAULT 1, mastodon_accounts_id INTEGER,
toot_id INTEGER DEFAULT 0, toot_id INTEGER,
FOREIGN KEY(user_id) REFERENCES user(id), FOREIGN KEY(user_id) REFERENCES user(id),
FOREIGN KEY(mastodon_accounts_id) FOREIGN KEY(mastodon_accounts_id)
REFERENCES mastodon_accounts(id) REFERENCES mastodon_accounts(id)

View file

@ -158,8 +158,8 @@ schlitz
db.execute("SELECT id FROM mastodon_instances WHERE instance = ?;", db.execute("SELECT id FROM mastodon_instances WHERE instance = ?;",
(instance_url,)) (instance_url,))
masto_instance = db.cur.fetchone()[0] masto_instance = db.cur.fetchone()[0]
db.execute("INSERT INTO seen_toots (user_id, mastodon_accounts_id) VALUES (?,?);", db.execute("INSERT INTO seen_toots (user_id, mastodon_accounts_id, toot_id) VALUES (?,?,?);",
(self.uid, masto_instance)) (self.uid, masto_instance, 0))
db.conn.commit() db.conn.commit()
return return