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

Open
wants to merge 6 commits into
base: main
Choose a base branch
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 from e08d38e to ba54aa8 Compare July 31, 2025 16:02
@georgesittas georgesittas force-pushed the jo/introduce_pre_checks branch from ba54aa8 to c3c6eac Compare July 31, 2025 16:37
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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy