add db
This commit is contained in:
parent
f0defdd918
commit
b0be25aafb
2 changed files with 24 additions and 0 deletions
6
backend/src/connect.py
Normal file
6
backend/src/connect.py
Normal file
|
@ -0,0 +1,6 @@
|
|||
import sqlite3
|
||||
|
||||
|
||||
def get_connection():
|
||||
conn = sqlite3.connect("jukebox.db")
|
||||
return conn
|
|
@ -1,4 +1,22 @@
|
|||
from dataclasses import dataclass
|
||||
from connect import get_connection
|
||||
|
||||
|
||||
def init_db():
|
||||
conn = get_connection()
|
||||
cursor = conn.cursor()
|
||||
cursor.execute("""
|
||||
CREATE TABLE IF NOT EXISTS songs (
|
||||
mbid TEXT PRIMARY KEY,
|
||||
title TEXT NOT NULL,
|
||||
artist TEXT NOT NULL,
|
||||
tags TEXT NOT NULL,
|
||||
lastfm_image_id TEXT NOT NULL,
|
||||
youtube_id TEXT NOT NULL
|
||||
);
|
||||
""")
|
||||
conn.commit()
|
||||
conn.close()
|
||||
|
||||
|
||||
@dataclass
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue