feat/server: add automatic DB migrations via refinery#25
Merged
Conversation
Owner
ClemPera
commented
Apr 13, 2026
- Add refinery dep with mysql_async feature
- Add migrations/V1__init.sql with user, user_token and note tables
- Run migrations at server startup before binding the listener
- Change main() to return anyhow::Result<()>
- Add refinery dep with mysql_async feature - Add migrations/V1__init.sql with user, user_token and note tables - Run migrations at server startup before binding the listener - Change main() to return anyhow::Result<()>
refinery-core 0.8 only supports mysql_async <= 0.35 while the project uses 0.36, causing an AsyncMigrate trait bound conflict. Replace with a minimal migration runner in migrations.rs that: - Creates schema_migrations table for version tracking - Runs each unapplied SQL file in order using the existing Conn - Records applied versions with timestamps - Embeds SQL files at compile time via include_str!
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.