Files
digiserver-v2/docs/09-legacy-and-migrations.md
T
ske087 46602f1933 Sanitize codebase, reorganize docs, and add missing deploy files
Remove dead code identified in docs/SANITIZATION-REVIEW.md:
- app/blueprints/content_old.py and app/blueprints/playlist.py
- app/models/group.py, app/utils/nginx_config_reader.py
- orphaned templates (content_list, edit_content, upload_content,
  player_page) and the related group/Template references

Result: 6 blueprints, 82 routes, no dead modules or orphan templates.

Add files that deploy.sh and docker-entrypoint.sh already require but
which were never tracked:
- https_manager.py       (referenced by deploy.sh, migrate_network.sh,
                          docker-entrypoint.sh)
- Caddyfile.example      (seeded by deploy.sh; its absence aborts deploy)

Relocate generated Graphify artifacts from graphify-out/ to
docs/graphify-out/ (110 files, no content change) and archive the
superseded docs under docs/.

Ignore hygiene:
- ignore ad-hoc .env backups (.env.bak*) — they contain live secrets
- keep the pre-sanitization snapshots (docs/legacy code/,
  docs/old_code_documentation/) on disk but out of the repo

Fix .env.example: drop a duplicated config block, genericize the
hardcoded host IP, and document HOSTNAME_INTERNAL.
2026-09-11 12:18:34 +03:00

4.0 KiB

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.pythat 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 DELETED Legacy per-player content routes. Removed in the sanitization pass together with its templates (content_list.html, edit_content.html, upload_content.html).
app/blueprints/playlist.py Active but legacy Per-player playlist routes kept as redirects to the modern content workflow.
Group model + group routes DELETED models/group.py, the group_content association, Content.groups / Content.group_count, and the group utility functions were removed. Player never had a group_id column.
utils/nginx_config_reader.py DELETED Legacy nginx parsing — the reverse proxy is Caddy.
nginx stack Replaced by Caddy data/nginx.conf, data/nginx-custom-domains.conf, data/nginx-logs/, data/nginx-ssl/ removed with the Caddy migration. migrate_network.sh no longer generates self-signed certs — Caddy issues them.
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.
docs/legacy code/ Snapshot Full pre-sanitization copy of the codebase. Excluded from the Docker build via .dockerignore.

  • Remove old_code_documentation/*.py scripts that are no longer needed (keep the .md docs).
  • Resolve the missing https_manager.py in deploy.shdone: https_manager.py now exists at the repo root.
  • Update verify-deployment.sh to reference Caddy instead of nginx — done.
  • Consider removing the legacy playlist.py blueprint (see SANITIZATION-REVIEW.md batch B1).

📚 Back to Index