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

sqlite: Add rollback support #4718

Merged
merged 1 commit into from Jun 24, 2023
Merged

sqlite: Add rollback support #4718

merged 1 commit into from Jun 24, 2023

Conversation

brunnre8
Copy link
Member

This enabled db migrations to be undone, or "down migrated". The down migration shouldn't be done automatically as it could lead to severe data loss if that were done. Hence, we still hard fail if we encounter a version lower than what we have in the DB.

A CLI will be added in a later commit that allows users to explicitly do that.

@brunnre8 brunnre8 requested a review from itsjohncs March 25, 2023 22:17
@brunnre8
Copy link
Member Author

@itsjohncs well... if we want to have down migrations, that's what it takes I guess.
Bunch of code, CLI is still missing.

I still don't think that auto migration in the downward direction makes any sense, so we hard fail still.

A later PR can add a CLI that calls storage.downgrade(), the infra is in place.

Happy with that approach?

@brunnre8 brunnre8 force-pushed the rollback branch 2 times, most recently from 3ea1f22 to c88244a Compare March 25, 2023 22:38
Copy link
Member

@itsjohncs itsjohncs left a comment

Choose a reason for hiding this comment

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

Looks good. Happy to punt the work of deeper testing and making the CLI for when it's actually needed.

server/plugins/messageStorage/sqlite.ts Outdated Show resolved Hide resolved
server/plugins/messageStorage/sqlite.ts Outdated Show resolved Hide resolved
This enables db migrations to be undone, or "down migrated".
The down migration shouldn't be done automatically
as it could lead to severe data loss if that were done.
Hence, we still hard fail if we encounter a version lower than what
we have in the DB.

A CLI will be added in a later commit that allows users to explicitly
do that.
Base automatically changed from migrationsPR to master June 24, 2023 13:15
@brunnre8 brunnre8 merged commit 2ef8b37 into master Jun 24, 2023
15 checks passed
@brunnre8 brunnre8 deleted the rollback branch June 24, 2023 13:15
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.

None yet

2 participants