Files
enterprise_digital-platform/digiserver-v2/migrations/add_weblink_url_to_content.py
T
ske087 4f4e017ad2 fix: player connectivity and media download pipeline
- nginx: add /api/ shortcut block (no portal auth, X-Script-Name /digiserver,
  Host $http_host) so players can reach DigiServer API without /digiserver prefix
- nginx: use $http_host in /api/ block so Flask host_url includes port — fixes
  media download URLs missing :8080 (was http://ip/digiserver/... not http://ip:8080/...)
- player main.py: fix double-port bug when server_ip already contains a port
  (e.g. 192.168.0.230:8080 was producing http://192.168.0.230:8080:80)
- get_playlists_v2.py: force re-sync when server version differs OR local media
  files are missing on disk — fixes stale playlist after server reset
- digiserver api.py: playlist endpoint builds full media URLs using script_root
  from X-Script-Name header set by nginx
- weblink support, player build/deploy improvements, manage-playlist AJAX prefix fix
2026-06-29 20:04:11 +03:00

35 lines
1.1 KiB
Python

"""Add url column to content table for web link playlist items.
Web link items are stored as Content rows with content_type='weblink' and the
target web page URL in the new 'url' column (NULL for file-based content).
Run with: python migrations/add_weblink_url_to_content.py
"""
import sys
sys.path.insert(0, '/app')
from app.app import create_app
from app.extensions import db
from sqlalchemy import text
app = create_app()
with app.app_context():
print("Adding url column to content table...")
try:
inspector = db.inspect(db.engine)
columns = [col['name'] for col in inspector.get_columns('content')]
if 'url' not in columns:
with db.engine.connect() as conn:
conn.execute(text('ALTER TABLE content ADD COLUMN url VARCHAR(2048)'))
conn.commit()
print("\u2713 url column added to content table!")
else:
print("\u2713 url column already exists in content table.")
except Exception as e:
print(f"Error adding url column: {str(e)}")
sys.exit(1)