Change field name (user_id -> chat_id) for consistency.

This commit is contained in:
Ceda EI 2018-10-27 15:27:13 +05:30
parent 7672e33b4e
commit d9e9104c93
1 changed files with 8 additions and 8 deletions

16
bot.py
View File

@ -34,20 +34,20 @@ db = sqlite3.connect("questable.db")
cursor = db.cursor() cursor = db.cursor()
# Set up tables # Set up tables
queries = [ queries = [
("CREATE TABLE IF NOT EXISTS quests(user_id int NOT NULL, qid int NOT" ("CREATE TABLE IF NOT EXISTS quests(chat_id int NOT NULL, qid int NOT"
" NULL, name varchar(255) NOT NULL, difficulty int NOT NULL, " " NULL, name varchar(255) NOT NULL, difficulty int NOT NULL, "
"importance int NOT NULL, completed int NOT NULL, date int NOT NULL" "importance int NOT NULL, date int NOT NULL, state int NOT NULL "
", state int NOT NULL DEFAULT 0, UNIQUE(user_id, qid));"), "DEFAULT 0, UNIQUE(chat_id, qid));"),
("CREATE TABLE IF NOT EXISTS side_quests(user_id int NOT NULL, qid int" ("CREATE TABLE IF NOT EXISTS side_quests(chat_id int NOT NULL, qid int"
" NOT NULL, name varchar(255) NOT NULL, difficulty int NOT NULL, " " NOT NULL, name varchar(255) NOT NULL, difficulty int NOT NULL, "
"importance int NOT NULL, completed int NOT NULL, date int NOT NULL" "importance int NOT NULL, date int NOT NULL, state int NOT NULL "
", state int NOT NULL DEFAULT 0, UNIQUE(user_id, qid));"), "DEFAULT 0, UNIQUE(chat_id, qid));"),
("CREATE TABLE IF NOT EXISTS points(user_id int PRIMARY KEY, points " ("CREATE TABLE IF NOT EXISTS points(chat_id int PRIMARY KEY, points "
"int);"), "int);"),
("CREATE TABLE IF NOT EXISTS state(user_id int PRIMARY KEY, state " ("CREATE TABLE IF NOT EXISTS state(chat_id int PRIMARY KEY, state "
"varchar(10));"), "varchar(10));"),
] ]
for query in queries: for query in queries: