32 lines
758 B
Python
32 lines
758 B
Python
from folkugat_web.dal.sql import Connection, get_connection
|
|
|
|
|
|
def create_db(con: Connection | None = None):
|
|
with get_connection(con) as con:
|
|
create_temes_table(con)
|
|
|
|
|
|
def drop_temes_table(con: Connection):
|
|
query = "DROP TABLE IF EXISTS temes"
|
|
cur = con.cursor()
|
|
_ = cur.execute(query)
|
|
|
|
|
|
def create_temes_table(con: Connection):
|
|
query = """
|
|
CREATE TABLE IF NOT EXISTS temes (
|
|
id INTEGER PRIMARY KEY,
|
|
title TEXT NOT NULL,
|
|
properties TEXT,
|
|
links TEXT,
|
|
lyrics TEXT,
|
|
alternatives TEXT,
|
|
ngrams TEXT,
|
|
creation_date TEXT NOT NULL,
|
|
modification_date TEXT NOT NULL,
|
|
hidden INTEGER NOT NULL
|
|
)
|
|
"""
|
|
cur = con.cursor()
|
|
_ = cur.execute(query)
|