Update database creation so I dont have to manually fsk with it anymore.

This commit is contained in:
iamBadgers
2026-05-17 17:39:45 -07:00
parent 66ede6eb4d
commit 7aa99f3a6b
2 changed files with 2 additions and 42 deletions

View File

@@ -10,46 +10,6 @@ def get_db():
return db
_game_table_create = """
CREATE TABLE IF NOT EXISTS "game_tables" (
"game_table_id" INTEGER NOT NULL UNIQUE,
"game_table_name" TEXT UNIQUE,
"game_table_link" TEXT UNIQUE,
"version" INTEGER,
"active" INTEGER,
"game_key" TEXT,
"docker_id" TEXT,
PRIMARY KEY("game_table_id")
);
"""
_key_table_create = """
CREATE TABLE IF NOT EXISTS "game_keys" (
"key" TEXT NOT NULL,
"game_table_id" INTEGER,
"key_file" TEXT NOT NULL,
PRIMARY KEY("key")
);
"""
_user_table_create = """
CREATE TABLE IF NOT EXISTS "users" (
"id" INTEGER NOT NULL,
"username" TEXT NOT NULL,
"hash" TEXT NOT NULL,
PRIMARY KEY ("id")
);
"""
def init_db(connection):
with SmartCursor(connection=connection) as smart_cursor:
smart_cursor.execute(_game_table_create)
smart_cursor.execute(_key_table_create)
smart_cursor.execute(_user_table_create)
connection.commit()
class SmartCursor:
connection: Connection
curosr: Cursor