Audit (docs/migration_history_audit.md): - files.size_bytes: INTEGER (Alembic) vs BIGINT (Produktion/Plugin) - GIN-Indizes: Fehlendes USING GIN in Alembic 0002 - guest_users: ix_guest_users_email_tenant fehlt UNIQUE in Alembic 0059 - plugins.name: Doppelter Unique-Index in Produktion Forward-Migrationen: - 0093: files.size_bytes INTEGER → BIGINT - 0094: GIN-Indizes reparieren + plugins.name doppelten Index entfernen - 0095: guest_users email+tenant_id UNIQUE INDEX (mit Dubletten-Check) - 0096: Workspace tenant_integrity (tenant-bound FKs) Tests: 41/41 bestanden (17 Workspace + 24 Command) Alembic Head: 0096
2.5 KiB
Migration History Audit
Erstellt: 2026-08-03 Alembic-Head: 0092 Produktions-Stand: 0092
Bestätigte Schema-Diskrepanzen
1. files.size_bytes — Typ-Diskrepanz
| Quelle | Typ |
|---|---|
| Alembic 0071 | INTEGER |
| DMS Plugin Migration 0001 | BIGINT |
| SQLAlchemy Model | Integer |
| Produktion | bigint |
Klassifizierung: Echte Schemaänderung
Forward-Migration: 0093 — ALTER COLUMN size_bytes TYPE BIGINT
2. GIN-Indizes — Fehlendes USING GIN
Alembic 0002 erstellt:
CREATE INDEX ix_companies_search_vec ON companies (search_tsv)
Produktion hat:
CREATE INDEX ix_companies_search_vec ON companies USING gin (search_tsv)
Betroffene Tabellen/Indizes (in Produktion als GIN vorhanden):
- contacts.ix_contacts_search_tsv
- audit_log.ix_audit_log_search_tsv
- calendar_entries.ix_cal_entries_search_tsv
- comm_messages.ix_comm_messages_search_tsv
- files.ix_files_content_tsv
- mails.ix_mails_body_tsv
- tags.ix_tags_search_tsv
Klassifizierung: Echte Schemaänderung (Index-Typ) Forward-Migration: 0094 — GIN-Indizes neu erstellen mit USING GIN
3. guest_users — Fehlender UNIQUE Constraint
Alembic 0059 erstellt:
CREATE INDEX ix_guest_users_email_tenant ON guest_users (email, tenant_id)
Model und Produktion haben:
CREATE UNIQUE INDEX ix_guest_users_email_tenant ON guest_users (email, tenant_id)
Klassifizierung: Echte Schemaänderung (Unique fehlt in Alembic) Forward-Migration: 0095 — Index als UNIQUE neu erstellen
4. plugins.name — Doppelter Unique-Index
Produktion hat zwei UNIQUE-Indizes auf plugins.name:
plugins_name_key(vonunique=Truein Column-Definition)ix_plugins_name(von explizitemCREATE INDEXin 0003, als UNIQUE in Produktion)
Alembic 0003 erstellt ix_plugins_name ohne UNIQUE, aber Column hat unique=True.
Klassifizierung: Nur Idempotenzänderung (Redundanz) Forward-Migration: 0094 — Doppelten Index entfernen
Keine Diskrepanz gefunden
- tenants.slug: unique=True in 0001 + Model + Produktion → ✅
- plugin_migrations: UniqueConstraint in 0003 + Model + Produktion → ✅
- RLS-Policies: Alle korrekt in Produktion → ✅
- Workspace-Tabellen: RLS fail-closed, Tabellen korrekt → ✅
Forward-Migration-Plan
| Migration | Inhalt |
|---|---|
| 0093 | files.size_bytes INTEGER → BIGINT |
| 0094 | GIN-Indizes reparieren + plugins.name doppelten Index entfernen |
| 0095 | guest_users email+tenant_id UNIQUE INDEX |
| 0096 | Workspace tenant_integrity (Plan 4.3) |