Skip to content

Conversation

kvch
Copy link
Contributor

@kvch kvch commented May 23, 2025

This PR adds a new subcommand to validate migration files called validate.

Usage:
  pgroll validate <file> [flags]

Examples:
validate migrations/03_my_migration.yaml

Flags:
  -h, --help   help for validate

It is first step towards providing a way to validate migration files before running them. At the moment it can validate a single migration file against the latest schema in the database. This can be added to your local workflow, or a linter to make sure that the newly added migration file is correct.

Future improvements can be

The PR contains some minor changes to the migration phase Start. Now migration validation is decoupled from it. The previous implementation of Start started a new migration before validating the migration it got as a parameter. So this change does not interfere with the UX of pgroll.

Closes #370

@github-actions github-actions bot temporarily deployed to Docs Preview May 23, 2025 13:48 Inactive
@github-actions github-actions bot temporarily deployed to Docs Preview May 23, 2025 14:13 Inactive
@kvch kvch force-pushed the feature-add-validate-command branch from a4ce22b to e4ff9f4 Compare May 23, 2025 14:17
@github-actions github-actions bot temporarily deployed to Docs Preview May 23, 2025 14:17 Inactive
@kvch kvch requested a review from andrew-farries June 2, 2025 11:43
Copy link
Collaborator

@andrew-farries andrew-farries left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, left one comment

Co-authored-by: Andrew Farries <andyrb@gmail.com>
@github-actions github-actions bot temporarily deployed to Docs Preview June 3, 2025 13:47 Inactive
@github-actions github-actions bot temporarily deployed to Docs Preview June 3, 2025 13:58 Inactive
@kvch kvch requested a review from andrew-farries June 3, 2025 13:59
@kvch kvch merged commit f8bf96f into xataio:main Jun 3, 2025
30 checks passed
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.

Validate a migration file
2 participants