recopytex/backend/adapters/sqlite.py

34 lines
603 B
Python

import sqlite3
def create_tribe_table(conn) -> None:
cursor = conn.cursor()
cursor.execute(
"""
CREATE TABLE IF NOT EXISTS tribes(
name VARCHAR PRIMARY KEY UNIQUE,
level VARCHAR
)
"""
)
conn.commit()
def create_student_table(conn) -> None:
cursor = conn.cursor()
cursor.execute(
"""
CREATE TABLE IF NOT EXISTS students(
id VARCHAR(500) PRIMARY KEY UNIQUE,
name VARCHAR,
tribe_name VARCHAR
)
"""
)
conn.commit()
def create_db(conn) -> None:
create_tribe_table(conn)
create_student_table(conn)