add sort id if it doesn't exist
This commit is contained in:
parent
02ca3d3a50
commit
c8d7e391a0
1 changed files with 2 additions and 2 deletions
4
main.py
4
main.py
|
@ -77,9 +77,9 @@ following = client.account_following(me.id)
|
||||||
db = sqlite3.connect("toots.db")
|
db = sqlite3.connect("toots.db")
|
||||||
db.text_factory=str
|
db.text_factory=str
|
||||||
c = db.cursor()
|
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:
|
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:
|
except:
|
||||||
pass # column already exists
|
pass # column already exists
|
||||||
db.commit()
|
db.commit()
|
||||||
|
|
Loading…
Reference in a new issue