default values are bad practice
This commit is contained in:
parent
a54538bcea
commit
faaf8ac5f4
8
db.py
8
db.py
|
@ -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)
|
||||||
|
|
4
user.py
4
user.py
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue