Session editor and live sessions!
This commit is contained in:
27
folkugat_web/dal/sql/playlists/ddl.py
Normal file
27
folkugat_web/dal/sql/playlists/ddl.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from typing import Optional
|
||||
|
||||
from folkugat_web.dal.sql import Connection, get_connection
|
||||
|
||||
|
||||
def create_db(con: Optional[Connection] = None):
|
||||
with get_connection(con) as con:
|
||||
create_playlists_table(con)
|
||||
|
||||
|
||||
def drop_playlists_table(con: Connection):
|
||||
query = "DROP TABLE IF EXISTS playlists"
|
||||
cur = con.cursor()
|
||||
cur.execute(query)
|
||||
|
||||
|
||||
def create_playlists_table(con: Connection):
|
||||
query = """
|
||||
CREATE TABLE IF NOT EXISTS playlists (
|
||||
id INTEGER PRIMARY KEY,
|
||||
session_id INTEGER NOT NULL,
|
||||
set_id INTEGER NOT NULL,
|
||||
tema_id INTEGER
|
||||
)
|
||||
"""
|
||||
cur = con.cursor()
|
||||
cur.execute(query)
|
||||
Reference in New Issue
Block a user