Fix: add validators to handle None values in Versions class#1654
Merged
georgesittas merged 4 commits intomainfrom Nov 2, 2023
Merged
Fix: add validators to handle None values in Versions class#1654georgesittas merged 4 commits intomainfrom
georgesittas merged 4 commits intomainfrom
Conversation
tobymao
approved these changes
Nov 2, 2023
Contributor
tobymao
left a comment
There was a problem hiding this comment.
can you make a test that actually migrated from n-1 to n?
Contributor
Author
|
I can try, maybe I need to mock out the schema version so that it doesn't pick v0032 or something |
Contributor
Author
|
Added a unit test for this. |
tobymao
reviewed
Nov 2, 2023
tests/core/test_state_sync.py
Outdated
| def test_migrate_only_to_add_sqlmesh_version_column(duck_conn, monkeypatch) -> None: | ||
| from sqlmesh import __version__ as SQLMESH_VERSION | ||
|
|
||
| n_migrations_before_sqlmesh_version = 31 |
Contributor
There was a problem hiding this comment.
make this n -1 so we always test the latest migration right
Contributor
Author
There was a problem hiding this comment.
It's not that simple because this test has logic specific to the 31 -> 32 migration, i.e. patching _update_versions and assuming that prior to that migration we don't have sqlmesh_version in state.
If we generalized this the above sections would not be valid e.g. for n-1 to n and the test would need additional guards etc
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.
...sigh