All workflows
Workflows/Data & schema/06

Change the schema

Write the migration in nvim, run it, and check the table in the next column. Ask the agent what else reads it before you merge.

The board

nvim The migration file.
Database The table before and after, and SQL you run yourself.
Agent Finds every query in the code that touches the table.

Step by step

  1. 01
    Check the data first Group refunds by idempotency_key in the Database column. Two keys have two refunds each, so a unique index on it would fail as things stand.
    database
  2. 02
    Write the migration In migrations/0043_refund_key.sql. Stripe paid both refunds of each pair, so neither is deleted: a duplicate_of column marks the later one, and the unique index leaves out what it marks.
    nvim
  3. 03
    Run it against dev Run it with :!pnpm migrate from nvim, then ask the Database column for the refunds marked as duplicates: the two from the race, each pointing at its key's first.
    database
  4. 04
    Check the blast radius Ask the agent what reads and writes refunds. It goes through each query and says what has to change before you merge.
    agent

Close the other windows.

Get ORVEN