Skip to content

Feat!: introduce migration pre-checks #5001

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from

Conversation

georgesittas
Copy link
Contributor

@georgesittas georgesittas commented Jul 23, 2025

Some SQLMesh versions introduce breaking changes that cannot be fully handled by simply manipulating state. These upgrades typically require users to update their project definition and apply a plan to complete the migration process. Without doing so, cadence runs may start failing after the upgrade, and applying a plan becomes necessary to restore normal operation.

The problem is that we currently have no way to inform the user that this additional step is required. The best we can do is issue a warning during the migration process (example), which is already too late. Users don’t get a chance to prepare for such a breaking upgrade and are forced to to fix their project ASAP or resort to rolling back their state.

This PR aims to address the above problem by introducing a new concept: pre-checks. These are scripts that correspond to a particular migration script and contain a single function pre_check.

The pre_check function's only purpose is to inspect the current state and determine whether the project will require a plan application after the migration is complete. It returns a list of messages that will be shown to the user, explaining any necessary changes on their end and outlining the steps they need to take.

It’s the responsibility of the developer introducing the breaking change to implement the pre_check function, in addition to the migrate function, when applicable.

@georgesittas georgesittas marked this pull request as draft July 23, 2025 13:59
@georgesittas georgesittas force-pushed the jo/introduce_pre_checks branch 2 times, most recently from 1217884 to 4813bd6 Compare July 23, 2025 14:01
@georgesittas georgesittas force-pushed the jo/introduce_pre_checks branch 2 times, most recently from 78d9ac5 to 6de997a Compare July 30, 2025 13:38
@georgesittas georgesittas changed the title Feat: introduce migration pre-checks Feat!: introduce migration pre-checks Jul 30, 2025
@georgesittas georgesittas marked this pull request as ready for review July 30, 2025 18:51
@georgesittas georgesittas force-pushed the jo/introduce_pre_checks branch 2 times, most recently from ba54aa8 to c3c6eac Compare July 31, 2025 16:37
@georgesittas georgesittas force-pushed the jo/introduce_pre_checks branch from c3c6eac to 4d23781 Compare August 11, 2025 08:57
@georgesittas georgesittas force-pushed the jo/introduce_pre_checks branch from 4d23781 to d400318 Compare August 12, 2025 12:57
@georgesittas
Copy link
Contributor Author

This has been deprioritized, so I'm closing it for now to reduce clutter in the PR list. Will keep the branch intact.

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.

2 participants