Until now, nothing made sure that the schema config, the generated files and the converters stayed in sync. `schema diff` only showed the differences, the regeneration check in CI didn't notice changes that produced the same generated files, and the reference converter could get out of sync with the schema without anyone noticing. Each check only compared against the previous step, so if one step was already stale, the checks after it passed even though they ran against stale data. This adds `disco check`. It runs all checks in dependency order (pending migrations, config validity, config vs. database drift, committed generated files, and converter column coverage, including columns and models that don't exist anymore) and stops at the first check that fails. On failure it prints copy-paste commands to fix the problem, for example the new `disco schema unignore`. CI runs the same command, so if it passes locally, the CI check passes too.
1.6 KiB
Vendored
Migrations Tooling — Agent Guide
Start with README.md — it is the single source of truth for this
project: gem layout and namespaces, the disco CLI, converters, the schema DSL,
and the install / test / lint workflow.
This file is reserved for agent-specific guidance that does not belong in the README (conventions, gotchas, do/don't notes for automated contributors).
Gotchas
-
Samovar reserves
nameon commands.Nested#parseinstantiates a sub-command withname:(its invocation name), which Samovar stores and exposes asname. So don't declare a positionalone :nameon adiscocommand — when the argument is omitted the accessor silently reads back the command's own name (e.g. aschema addcommand would read back"add") instead ofnil. Name the positional something else (one :table_name, …). -
Samovar positionals are never required. Don't use
one :x, required: true— it raises during parsing, beforecallruns, which breaks the-h/--helphandling. Leave positionals optional and validate them at the top ofcallwithrequire_positional!(seeMigrations::CLI::Command); it raises a presentable error, so the user gets a clean message instead of a backtrace. -
Don't give command groups a
-h/--helpoption. The option hoisting inCommand#parsemoves recognized flags to the front, so a group-level help option steals--helpfrom the subcommands —group sub --helpwould run the subcommand instead of printing its help. Leave groups without options; a baregroup --helpsurfaces as an unparsable token, whichBootstrapturns into usage with exit 0.