fix: surface migration configuration mistakes instead of ignoring them - #670
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #670 +/- ##
==========================================
+ Coverage 77.26% 77.28% +0.01%
==========================================
Files 475 475
Lines 67901 67949 +48
Branches 9335 9344 +9
==========================================
+ Hits 52462 52511 +49
+ Misses 12035 12032 -3
- Partials 3404 3406 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
cofin
force-pushed
the
fix/626-migration-cli-quickstart
branch
from
August 1, 2026 22:28
5b364cb to
12b4a0d
Compare
cofin
marked this pull request as ready for review
August 1, 2026 22:28
Every failure reported in the migration quickstart issue was silent or misdirected: a misspelled migration_config key did nothing, pointing --config at a module crashed with an AttributeError about bind_key, and the help text that should have shown the pyproject section name rendered it as empty. - Reject migration_config keys SQLSpec does not read, naming the closest valid key. A typo such as version_table instead of version_table_name previously left the setting at its default with no signal. - Report the module:attribute references a module exports when --config names the module itself. - Report the accepted syntax for references that misuse ':'. - Keep SQLSpec errors raised while importing a config module intact rather than rewrapping them as import failures, while dependency errors stay ImportError. - Render [tool.sqlspec] in the no-config help text and stop mangling config paths containing colons. - Declare the author key on MigrationConfig, which the generator already read. - Restructure the migrations guide around the task order: a tested quickstart first, then configuration, schema support, extensions, and output. Document reference precedence and comma-separated multi-config references. Closes #626.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Getting started with migrations failed in ways that gave no useful signal: a misspelled configuration key did nothing at all, pointing
--configat a module crashed with an unrelatedAttributeError, and the error text meant to show thepyproject.tomlsection name printed it as blank. This makes each of those say what is actually wrong, and reorganizes the migrations guide so the working path is the first thing you read.What changed
migration_configaccepted any key and ignored the ones it did not recognize, soversion_tableinstead ofversion_table_namesilently left the tracking table at its default name. Unknown keys now raise and name the closest valid key.sqlspec --config databaseused to fail withAttributeError: module 'database' has no attribute 'bind_key'. It now reports the references that module exports, such asdatabase:database_config.[tool.sqlspec], which console markup was consuming, and config paths containing colons are no longer mangled.authoris a declared migration setting. The migration generator already read it, but type checkers rejected it.How you use it
Export a configuration and point the CLI at it with
module:attribute:Set
SQLSPEC_CONFIGor[tool.sqlspec]inpyproject.tomlto skip the flag;--configwins over the environment variable, which wins overpyproject.toml. Separate references with commas to manage several databases at once.Documentation
The migrations guide now leads with a quickstart that is executed by the documentation test suite, followed by configuration, running against an existing schema, extension migrations, and output control. The adapter schema-support matrix is split into supported and unsupported tables and moved below the material most readers need. The broken workflow GIF is gone.
Upgrading
Rejecting unknown
migration_configkeys is a behavior change. A configuration carrying a stray key previously started and quietly ignored it; it now raises at construction with the corrected key name. Remove or fix the key to upgrade.Closes #626.