2024-09-02 09:02:32 +02:00
|
|
|
import sqlite3
|
|
|
|
|
|
|
|
def init_db():
|
|
|
|
conn = sqlite3.connect('games.db')
|
|
|
|
cursor = conn.cursor()
|
2024-09-02 09:31:38 +02:00
|
|
|
|
|
|
|
# Tabelle für Spiele erstellen
|
2024-09-02 09:02:32 +02:00
|
|
|
cursor.execute('''
|
|
|
|
CREATE TABLE IF NOT EXISTS games (
|
|
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
|
|
image TEXT,
|
|
|
|
title TEXT NOT NULL,
|
|
|
|
date TEXT,
|
|
|
|
buyer TEXT,
|
|
|
|
owned BOOLEAN NOT NULL
|
|
|
|
)
|
|
|
|
''')
|
2024-09-02 09:31:38 +02:00
|
|
|
|
|
|
|
# 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
|
|
|
|
)
|
|
|
|
''')
|
|
|
|
|
2024-09-02 09:02:32 +02:00
|
|
|
conn.commit()
|
|
|
|
conn.close()
|