From 49d3001fbf4a2995ffdb96706de42d81f935662e Mon Sep 17 00:00:00 2001 From: CREDO23 Date: Fri, 26 Jun 2026 17:59:05 +0200 Subject: [PATCH] docs(db): tighten migration 170 docstring, move publication invariant to call site Trim the header to a one-line summary and relocate the "never raw DROP/CREATE PUBLICATION" invariant (bug #1355, migration 116) to the apply_publication call site where a refactor would actually occur. Comment/docstring only; no behavior change. --- .../170_rename_searchspace_to_workspace.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/surfsense_backend/alembic/versions/170_rename_searchspace_to_workspace.py b/surfsense_backend/alembic/versions/170_rename_searchspace_to_workspace.py index dc2d75830..2815f9603 100644 --- a/surfsense_backend/alembic/versions/170_rename_searchspace_to_workspace.py +++ b/surfsense_backend/alembic/versions/170_rename_searchspace_to_workspace.py @@ -1,15 +1,8 @@ """rename searchspace schema to workspace -Physically renames the SearchSpace schema to WorkSpace: tables, the -``search_space_id`` / ``owner_search_space_id`` columns, the named -constraints/indexes/sequences that embed the old name, and the auto-named -FK/PK/sequence objects. The Zero publication is reconciled to the renamed -``workspace_id`` column lists via the blessed ``apply_publication`` path -(never raw DROP/CREATE PUBLICATION -- see migration 116). - -This is the existing-deployment upgrade path (chains after head 169). The -from-scratch ``alembic upgrade head`` path is a separate, pre-existing concern -(0_initial uses create_all of the current ORM); it is out of scope here. +Renames the SearchSpace tables/columns/constraints/indexes/sequences to the +workspace_* names the ORM already declares, and reconciles the Zero publication +to match. Revision ID: 170 Revises: 169 @@ -488,8 +481,9 @@ def upgrade() -> None: for old, new in SEQUENCE_RENAMES: _rename_sequence(conn, old, new) - # Reconcile to the new workspace_id shape (blessed SET TABLE path); no-op - # if the publication does not exist. + # Reconcile to the new workspace_id shape via the blessed apply_publication + # path (ALTER ... SET TABLE) -- never raw DROP/CREATE PUBLICATION (bug #1355, + # migration 116). No-op if the publication does not exist. apply_publication(conn)