2026-09-02 20:42:52 +08:00

1.6 KiB

Database migrations

Migrations are forward-only and operate on OceanBase MySQL canonical metadata. Run make migration-check to render the full upgrade path without changing a database. Integration tests also apply the migration to a temporary database and compare it with SQLAlchemy metadata.

The target OceanBase database is shared. Alembic autogenerate and drift checks are intentionally scoped to tables present in EKP Base.metadata; unrelated application tables and the separately provisioned vector-index table are never reflected or treated as migration targets.

OceanBase adds BLOCK_SIZE ... LOCAL syntax that SQLAlchemy's stock MySQL reflector does not recognize for secondary indexes, unique constraints, and foreign keys. Real OceanBase drift checks therefore compare columns, types, defaults, and primary keys while excluding those three falsely reported object types. Full constraint comparison still runs against SQLite in integration tests; target-cluster checks separately verify HNSW/PRE-FILTER and the single-active generated unique index.

DEMO-015 adds ingestion_jobs and ingestion_attempts. The former is the canonical execution state; the latter preserves numbered history and uses a generated nullable active marker plus a unique index to reject two running Attempts for the same Job on both OceanBase MySQL and SQLite.

DEMO-016 adds ingestion_batches and ingestion_batch_items. They retain input order and per-file acceptance references while Job rows remain the processing state source of truth; a batch is an aggregate, not a cross-file transaction.