Escollir partitura del tema en un set

This commit is contained in:
marc
2026-02-16 23:03:01 +01:00
parent 443c1b1391
commit 89f72dbb33
13 changed files with 1385 additions and 22 deletions

View File

@@ -0,0 +1,41 @@
#!/usr/bin/env python3
"""
Migration script to add score_id column to playlist_entries table.
This allows playlist entries to optionally specify which score to use for a tune.
"""
import sqlite3
import sys
from pathlib import Path
# Add the project root to the path so we can import project modules
project_root = Path(__file__).parent
sys.path.insert(0, str(project_root))
from folkugat_web.config.db import DB_FILE
def main():
print(f"Connecting to database at: {DB_FILE}")
with sqlite3.connect(DB_FILE) as con:
cur = con.cursor()
# Check if score_id column already exists
cur.execute("PRAGMA table_info(playlist_entries)")
columns = [column[1] for column in cur.fetchall()]
if 'score_id' not in columns:
print("Adding score_id column to playlist_entries table...")
cur.execute("ALTER TABLE playlist_entries ADD COLUMN score_id INTEGER")
print("Column added successfully.")
else:
print("score_id column already exists.")
con.commit()
print("Migration completed successfully!")
if __name__ == "__main__":
main()