From 0f547aa1dc4423ea18b97e4d14e76800e78cb9af Mon Sep 17 00:00:00 2001 From: "Manuel Weiser (aider)" Date: Mon, 2 Sep 2024 09:31:38 +0200 Subject: [PATCH] feat: create database initialization script with games and users tables --- game_collection/database.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/game_collection/database.py b/game_collection/database.py index 5d2ff0e..d408340 100644 --- a/game_collection/database.py +++ b/game_collection/database.py @@ -3,6 +3,8 @@ import sqlite3 def init_db(): conn = sqlite3.connect('games.db') cursor = conn.cursor() + + # Tabelle für Spiele erstellen cursor.execute(''' CREATE TABLE IF NOT EXISTS games ( id INTEGER PRIMARY KEY AUTOINCREMENT, @@ -13,5 +15,15 @@ def init_db(): 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.close()