DATA OPS

Nightly staging-vs-prod schema drift to Linear migration ticket

Compares the column and index definitions between your staging and production Postgres databases every night and, when they diverge, opens a Linear migration-review ticket…

CategoryData Ops
Enginesim
Difficultyintermediate
Triggerschedule
Steps6
Setup~15 min

How it runs

The automated pipeline, trigger to output.

  • TriggerNightly schedule
  • ActionRead staging schema catalogPostgreSQLPostgres
  • ActionRead production schema catalogPostgreSQLPostgres
  • LogicDiff schemas; exit if identical
  • ActionFormat the DDL diff into a migration brief
  • OutputOpen Linear migration-review issueLinearLinear

What it does

Every night this workflow snapshots the `information_schema` of both your staging and production Postgres instances, diffs them table-by-table, and files a Linear ticket whenever staging has drifted ahead of (or behind) production. The ticket body contains the precise DDL difference so a reviewer can approve the migration without hunting it down.

When to use it

Use it when staging is your migration proving ground and you want a paper trail before anything reaches prod. It catches the classic failure mode where a developer altered staging directly and forgot to write the production migration.

How it works

  1. 1A nightly schedule fires the run.
  2. 2Query `information_schema.columns` and `pg_indexes` from staging.
  3. 3Query the same catalogs from production.
  4. 4Diff the two snapshots; if they are identical, the run exits quietly.
  5. 5When drift exists, format the added/dropped/altered objects into a readable migration brief.
  6. 6Open a Linear issue in the migration-review project with the diff attached and label `schema-drift`.

Set it up

What you configure once, before turning it on.

  1. 1
    Connect PostgresAny Postgres URL — query, write, migrate.
  2. 2
    Connect LinearIssues, projects, cycles, triage.
  3. 3
    Set each agent's modelWe leave models unset so you pick the tier — fast + cheap, or top-quality.
  4. 4
    Tune it to your dataEdit the prompts, filters, and field mappings so it matches how your team works.
  5. 5
    Test, then turn it onRun once against a sample, confirm the output, then enable the trigger.

Run this workflow in your colony.

14-day trial. No DevOps. No Sales call. Provisioned in under a minute.