- Added edit_on_player_enabled column to playlist_content table - Updated playlist model to track edit enablement per content item - Added UI checkbox on upload media page to enable/disable editing - Added toggle column on manage playlist page for existing content - Updated API endpoint to return edit_on_player_enabled flag to players - Fixed docker-entrypoint.sh to use production config - Supports PDF, Images, and PPTX content types
48 lines
1.4 KiB
Python
48 lines
1.4 KiB
Python
"""Migration: Add edit_on_player_enabled column to playlist_content table."""
|
|
import sqlite3
|
|
import os
|
|
|
|
DB_PATH = 'instance/dashboard.db'
|
|
|
|
def migrate():
|
|
"""Add edit_on_player_enabled column to playlist_content."""
|
|
if not os.path.exists(DB_PATH):
|
|
print(f"Database not found at {DB_PATH}")
|
|
return False
|
|
|
|
conn = sqlite3.connect(DB_PATH)
|
|
cursor = conn.cursor()
|
|
|
|
try:
|
|
# Check if column already exists
|
|
cursor.execute("PRAGMA table_info(playlist_content)")
|
|
columns = [col[1] for col in cursor.fetchall()]
|
|
|
|
if 'edit_on_player_enabled' in columns:
|
|
print("Column 'edit_on_player_enabled' already exists!")
|
|
return True
|
|
|
|
# Add the new column with default value False
|
|
print("Adding 'edit_on_player_enabled' column to playlist_content table...")
|
|
cursor.execute("""
|
|
ALTER TABLE playlist_content
|
|
ADD COLUMN edit_on_player_enabled BOOLEAN DEFAULT 0
|
|
""")
|
|
|
|
conn.commit()
|
|
print("✅ Migration completed successfully!")
|
|
print("Column 'edit_on_player_enabled' added with default value False (0)")
|
|
|
|
return True
|
|
|
|
except Exception as e:
|
|
conn.rollback()
|
|
print(f"❌ Migration failed: {e}")
|
|
return False
|
|
|
|
finally:
|
|
conn.close()
|
|
|
|
if __name__ == '__main__':
|
|
migrate()
|