Skip to content

Implement parameter substitution for migrations#3847

Closed
krlohnes wants to merge 21 commits into
transact-rs:mainfrom
krlohnes:issue-3178-v2
Closed

Implement parameter substitution for migrations#3847
krlohnes wants to merge 21 commits into
transact-rs:mainfrom
krlohnes:issue-3178-v2

Conversation

@krlohnes
Copy link
Copy Markdown

Does your PR solve an issue?

fixes #3178

Is this a breaking change?

No. The addition of fields to the Migrator is semver exempt, The MigrateError enum is #[non-exhaustive]. The new macro functionality retains the existing functionality of the crate and should be backward compatible. I'm making the assumption that changes to the function signatures of sqlx-cli are not considered breaking, but please correct me if I'm wrong there.

krlohnes added 21 commits April 23, 2025 13:54
This commit adds the actual processing of template parameters for
migrations. It also switches over `args` for `parameters` to be more in
line with the nomenclature in the issue
Was treating it like it did, so it wasn't working
- Restored parameter support in migrate macro while maintaining compatibility with main branch API
- Fixed test code to use SqlStr instead of Cow<String> for SQL migration content
- All parameter processing tests now pass:
  - test_migration_process_parameters_with_substitution
  - test_migration_process_parameters_no_substitution
  - test_migration_process_parameters_missing_key
  - test_migration_process_parameters_missing_key_with_default_value
- UI tests for parameter validation also pass
- Migration functionality works with both simple path and parameter-based approaches
@krlohnes krlohnes closed this Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add migration parameters or the possibility of passing migrations by string

1 participant