Repository navigation
Conversation
`after` was a u64, so only tools whose versions are plain numbers could use it. It now takes a number or a string (`MigrationVersion`), and both `after` and the version of each migration file are read with the selected tool's `version()`. A value that isn't a version of the tool ignores nothing, and the CLI and the editor show a warning (`ConfigurationNotice::InvalidSettings`).
This branch has not been deployed
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.
Stacked on #1103.
migrations.afterwas au64, so it only worked for migration tools whose versions are plain numbers, and a value that matched no file name ignored nothing without saying so. Since #993, each migration tool reads the version of its migration files itself (MigrationTool::version), soaftercan be read the same way:{ "migrations": { "migrationsDir": "migrations", "after": "0042" } } // same as 42What changed
migrations.afteris aMigrationVersion: a number or a string (#[serde(untagged)]),integer | stringinschema.json.--aftertakes aVERSION; digits are read as a number. Existing configurations keep working.afterand the version of each migration file are both read with the selected tool'sversion(), and a file is ignored when its version is at mostafter. All current tools read<number>_<name>.sqlwith leading zeros stripped, so"0042"and42are the same, as before."v1", ignores nothing, as before, but now the CLI prints a warning and the editor shows one: "migrations.afterisv1, which is not a version of goose migrations, so no migration is ignored. …". It's a newConfigurationNotice::InvalidSettings, next to the deprecation notices.0, the default, isn't reported.migrations.toolis looked up in one place now (settings::migration_tool).just gen-lintregeneratedschema.json, the TS bindings and the CLI reference.Tests
pgls_configuration:after_is_a_number_or_a_string(number, string,FromStrwith leading zeros and text, negative numbers rejected).pgls_workspace:migrations_after_is_a_number_or_a_string(number and string, leading zeros inafterand in file names, an invalid value ignoring nothing),reports_an_after_that_is_not_a_version_of_the_tool.nested_configurations_have_their_own_migrations_settingsand the CLI--aftertests are unchanged.Not covered
--aftergiven on the command line isn't checked for the warning, onlyafterin a configuration file.Update:
--afteris checked too now. The configuration notices are about the file, so the CLI checks the configuration as applied when--afteris given, with the tool of the file or of--migration-tool, and prints the same warning (after_argument_that_is_no_version_is_reported). The first "Not covered" item is done.