mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-06 22:12:12 +02:00
Phase 1 (rename DB) commit 3: single Alembic migration (down_revision=169) that physically renames the SearchSpace schema to WorkSpace to match the already-shimmed ORM. Renames 4 tables, 24 columns (search_space_id->workspace_id, owner_search_space_id->owner_workspace_id), 37 named/auto FK/PK/unique constraints, 25 indexes, and 4 sequences. Guarded forms (ALTER ... IF EXISTS / DO-block RENAME CONSTRAINT) tolerate runtime-created and absent objects. Zero publication is reconciled via the blessed path: neutralize the four column-list tables (documents/automations/new_chat_threads/podcasts) from the publication, rename, then apply_publication() re-emits SET TABLE with the new workspace_id lists (no raw DROP/CREATE PUBLICATION, per migration 116). Downgrade fully reverses the renames and restores the old search_space_id publication shape via a hardcoded SET TABLE, never importing the live module. Targets the existing-deployment upgrade path (169 -> 170). The from-scratch alembic path is a separate, pre-existing concern (0_initial uses create_all). Verified on a realistic legacy@169 DB (with publication): upgrade clean, zero_publication --verify passes, autogenerate EMPTY on a create_all DB, and upgrade->downgrade->upgrade round-trips (old shape + old publication restored on downgrade). Single alembic head = 170. |
||
|---|---|---|
| .. | ||
| alembic | ||
| app | ||
| scripts | ||
| tests | ||
| .dockerignore | ||
| .env.example | ||
| .gitignore | ||
| .python-version | ||
| alembic.ini | ||
| celery_worker.py | ||
| Dockerfile | ||
| main.py | ||
| pyproject.toml | ||
| uv.lock | ||