coffre ObsiGate Phase 4 (issue #22) : app/migrations.py
FlowDeck CI / lint (push) Failing after 3s
FlowDeck CI / test (push) Failing after 1s
FlowDeck CI / docker (push) Skipped

This commit is contained in:
2026-10-27 23:48:09 -04:00
parent 30387c4ed4
commit b751c81120
+28
View File
@@ -2076,3 +2076,31 @@ def _migration_draco_links(conn: sqlite3.Connection) -> None:
) )
""" """
) )
@register(52, "coffre ObsiGate (Phase 4) : workspace_id + coffre_reference sur agent_connectors")
def _migration_coffre_reference(conn: sqlite3.Connection) -> None:
"""Migration 52 — références ObsiGate pour les connecteurs (issue #22).
* ``workspace_id`` : le connecteur appartient à un workspace (NULL =
connecteur historique global, conservé tel quel — migration
opportuniste, pas de big-bang).
* ``coffre_reference`` : ``coffre:<slug>/<nom>`` (métadonnée, pas une
valeur) ; vide = jeton chiffré local historique.
Idempotente (gardée par ``columns()``), comme les migrations 32/34.
"""
cols = columns(conn, "agent_connectors")
if "workspace_id" not in cols:
conn.execute(
"ALTER TABLE agent_connectors "
"ADD COLUMN workspace_id INTEGER REFERENCES workspaces(id)"
)
if "coffre_reference" not in cols:
conn.execute(
"ALTER TABLE agent_connectors "
"ADD COLUMN coffre_reference TEXT NOT NULL DEFAULT ''"
)
conn.execute(
"CREATE INDEX IF NOT EXISTS idx_agent_connectors_workspace "
"ON agent_connectors(workspace_id)"
)