Skip to main content

run_migration

Function run_migration 

Source
pub async fn run_migration(
    pool: &Pool<Postgres>,
    registry: &SchemaRegistry,
) -> Result<(), OperationOutcomeError>
Expand description

Creates the shared tables, then a per-resource-type table for every schema in registry. Idempotent โ€” safe to re-run on an existing database.

New search parameters added by a later release show up as new columns on the existing tables via ADD COLUMN IF NOT EXISTS, so an upgrade never requires a reindex to add a parameter (existing rows keep NULL until the resource is next indexed).

ยงErrors

Returns an error if the migration lock cannot be taken, or if any of the DDL fails โ€” a connection drop, or a table an earlier release left in a shape this one cannot reconcile.