feat: create database initialization script with games and users tables
This commit is contained in:
parent
4161c30327
commit
0f547aa1dc
@ -3,6 +3,8 @@ import sqlite3
|
|||||||
def init_db():
|
def init_db():
|
||||||
conn = sqlite3.connect('games.db')
|
conn = sqlite3.connect('games.db')
|
||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
|
|
||||||
|
# Tabelle für Spiele erstellen
|
||||||
cursor.execute('''
|
cursor.execute('''
|
||||||
CREATE TABLE IF NOT EXISTS games (
|
CREATE TABLE IF NOT EXISTS games (
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
@ -13,5 +15,15 @@ def init_db():
|
|||||||
owned BOOLEAN NOT NULL
|
owned BOOLEAN NOT NULL
|
||||||
)
|
)
|
||||||
''')
|
''')
|
||||||
|
|
||||||
|
# Tabelle für Benutzer erstellen
|
||||||
|
cursor.execute('''
|
||||||
|
CREATE TABLE IF NOT EXISTS users (
|
||||||
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
username TEXT NOT NULL UNIQUE,
|
||||||
|
password TEXT NOT NULL
|
||||||
|
)
|
||||||
|
''')
|
||||||
|
|
||||||
conn.commit()
|
conn.commit()
|
||||||
conn.close()
|
conn.close()
|
||||||
|
Loading…
Reference in New Issue
Block a user