/ Migrations / Schema drift
Docs/Migrations/Schema drift

Schema drift

Your application keeps shipping new fields while a live sync runs. Drift handling decides what happens to a field the schema mapping doesn't know about yet.

What counts as drift

During a MongoDB live sync, every change event is compared against the migration's schema mapping. A field present in the document but absent from the mapping is drift. Each one is recorded once, with the field, the inferred type and the action taken.

i

Drift detection runs on MongoDB live syncs. For other sources, re-run schema inference before starting a new migration to pick up new fields.

Drift policies

PolicyWhat happens
add_columnDefault. NoSQLSync adds a column with the inferred type (ALTER TABLE … ADD COLUMN), updates the mapping and keeps streaming. The new field is populated from that point on.
ignoreThe field is recorded but not copied. The sync keeps running.
alert_and_pauseThe migration is set to paused so a person can review the change, update the mapping and resume.

Every drift event — whatever the policy — fires a schema.drift webhook.

Target support

Adding columns automatically works on PostgreSQL, MySQL and MariaDB targets. On SQL Server and warehouse targets (BigQuery, Snowflake, Redshift, ClickHouse) the field is recorded with action unsupported_target and skipped — add the column yourself and update the mapping, or use alert_and_pause to be told immediately. MongoDB targets need no schema changes and copy new fields automatically.

Changing the policy

Set the policy when creating a migration, or change it at any time:

PATCH /migrations/:id
{ "driftPolicy": "alert_and_pause" }

Reviewing drift

The migration page lists recent drift events. Over the API:

GET /migrations/:id/drift

Each event includes sourceField, targetColumn, type and action — one of added_column, ignored, paused or unsupported_target.

Recommendations

  • Use add_column for analytics replicas where new fields should just appear.
  • Use alert_and_pause for migrations feeding a production application, where an unexpected column should be reviewed.
  • Use ignore for collections with free-form metadata you never want as columns.