Skip to content
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

Migrations #1181

Merged
merged 10 commits into from
Nov 29, 2024
Merged

Migrations #1181

merged 10 commits into from
Nov 29, 2024

Conversation

tomchop
Copy link
Collaborator

@tomchop tomchop commented Nov 28, 2024

This PR introduces a migration framework for ArangoDB and includes an initial migration to update the database to version 2.

The migration framework allows for incremental updates to the database schema and data, ensuring that the database remains consistent across different versions of the application.

This initial migration ensures that a new field introduced in #1175, is_valid, is populated on all database Obseravbles.

@tomchop tomchop requested a review from udgover November 28, 2024 10:30
Copy link
Collaborator

@udgover udgover left a comment

Choose a reason for hiding this comment

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

Really cool and needed PR! I'm approving it even if I have a question regarding migration number handling.

Should we also include a command in yetictl rather than running poetry run python core/migrations/arangodb.py?

This will also be useful to handle stop_at argument.

def update_db_version(self, version: int):
raise NotImplementedError

def migrate_to_latest(self, stop_at: int = None):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why don't rely on migration name which already includes a number?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The functions are arbitrarily named, so we wanna calculate them from the order they've been pushed in

core/migrations/arangodb.py Show resolved Hide resolved
@tomchop tomchop merged commit de59609 into main Nov 29, 2024
3 checks passed
@tomchop tomchop deleted the migrations branch November 29, 2024 16:04
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