Files
digiserver-v2/add_muted_column.py
2025-11-20 20:46:09 +02:00

34 lines
1.2 KiB
Python
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env python3
"""Add muted column to playlist_content table."""
from app.app import create_app
from app.extensions import db
def add_muted_column():
"""Add muted column to playlist_content association table."""
app = create_app()
with app.app_context():
try:
# Check if column already exists
result = db.session.execute(db.text("PRAGMA table_info(playlist_content)")).fetchall()
columns = [row[1] for row in result]
if 'muted' in columns:
print(" Column 'muted' already exists in playlist_content table")
return
# Add muted column with default value True (muted by default)
db.session.execute(db.text("""
ALTER TABLE playlist_content
ADD COLUMN muted BOOLEAN DEFAULT TRUE
"""))
db.session.commit()
print("✅ Successfully added 'muted' column to playlist_content table")
print(" Default: TRUE (videos will be muted by default)")
except Exception as e:
db.session.rollback()
print(f"❌ Error adding column: {e}")
if __name__ == '__main__':
add_muted_column()