# 09 · Migrations & Legacy Components --- ## 1. Migrations Migrations are **standalone Python scripts** (run via `docker compose exec ... python`, **not** Alembic revisions — there is no `migrations/versions/`). | Script | Table(s) | What it does | |---|---|---| | `add_https_config_table.py` | `https_config` | Creates table via `db.create_all()` | | `add_player_user_table.py` | `player_user` | Creates table via `db.create_all()` | | `add_email_to_https_config.py` | `https_config` | `ALTER TABLE ... ADD COLUMN email VARCHAR(255)` (idempotent) | | `add_deployment_fields_to_player.py` | `player` | Adds `deployment_status`, `last_deployment_at`, `last_deployment_status`, `last_deployment_message` (idempotent) | | `add_url_to_content.py` | `content` | `ALTER TABLE ... ADD COLUMN url VARCHAR(2048)` (weblink support) | | `add_original_filename_to_content.py` | `content` | Adds `original_filename` then **backfills**: from first (v1) `PlayerEdit.original_name` for edited content, else `filename` | | `migrate_player_user_global.py` | `player_user` | **Drop & recreate**: removes old `player_id` FK, makes `user_code` globally unique, `user_name` nullable | **Order (from `deploy.sh`):** ``` add_https_config_table.py add_player_user_table.py add_email_to_https_config.py migrate_player_user_global.py add_original_filename_to_content.py ``` > ⚠ `deploy.sh` also calls `/app/https_manager.py` — **that file is not present in this repo**, so that deployment step needs attention. --- ## 2. Legacy / Archived Components | Component | Status | Notes | |---|---|---| | `app/blueprints/content_old.py` | **Dead code** | Legacy per-player content routes (`/`, `/upload`, `//edit`, `/bulk/delete`, `/upload-progress`, `/preview`, `/statistics`, `/check-duplicates`, `//groups`). Not imported by `create_app`. | | `app/blueprints/playlist.py` | **Active but legacy** | Per-player playlist routes kept as redirects to the modern content workflow. | | `Group` model + group routes | **Archived** | `Player` no longer has `group_id`; group routes commented out; `group_player_management.py` and `group_content` association remain for reference. | | `nginx` stack | **Replaced by Caddy** | `data/nginx.conf`, `data/nginx-custom-domains.conf`, `data/nginx-logs/`, `data/nginx-ssl/` retained. `utils/nginx_config_reader.py` still parses it. | | `https_manager.py` | **Missing** | Referenced by `deploy.sh` but not in repo — likely merged into `CaddyConfigGenerator`. | | `old_code_documentation/` | **Archive** | Full legacy docs, old scripts (`blueprint_groups.py`, `add_muted_column.py`, `fix_player_user_schema.py`, `test_edit_media_*.py`, `check_fix_player.py`, `migrate_add_edit_enabled.py`), deployment guides, HTTPS analysis, player analysis. | | `QUICK_DEPLOYMENT.md`, `deployment-commands-reference.sh` | **Active reference** | Manual deployment notes. | --- ## 3. Recommended Cleanup (optional) - Remove `content_old.py` and `old_code_documentation/*.py` scripts that are no longer needed (keep the `.md` docs). - Resolve the missing `https_manager.py` in `deploy.sh` (use `CaddyConfigGenerator` equivalents). - Update `verify-deployment.sh` to reference Compose v2 and Caddy instead of `docker-compose`/nginx. --- ## 📚 Back to Index - [README · Documentation Home](README.md) - [01 · Architecture](01-architecture.md) - [02 · Knowledge Graph](02-knowledge-graph.md) - [03 · Data Model](03-data-model.md) - [04 · Application Core](04-application-core.md) - [05 · Blueprints & API](05-blueprints-api.md) - [06 · Utils & Services](06-utils-services.md) - [07 · Deployment](07-deployment.md) - [08 · Workflows](08-workflows.md)