Skip to content

feat: port diesel migrations to the new framework#2104

Merged
Mirko-von-Leipzig merged 7 commits into
nextfrom
mirko/validator-migration
May 21, 2026
Merged

feat: port diesel migrations to the new framework#2104
Mirko-von-Leipzig merged 7 commits into
nextfrom
mirko/validator-migration

Conversation

@Mirko-von-Leipzig
Copy link
Copy Markdown
Collaborator

@Mirko-von-Leipzig Mirko-von-Leipzig commented May 20, 2026

Migrates the sqlite migrations to the new framework introduced in #2093.

I also made some changes to the framework after dog fooding it here.

  • CI runs diesel schema tests to ensure they match the migrations.
  • active migrations now accepts raw SQL migrations in addition to rust ones
  • migration codegen now expects a flat set of active migration files instead of folders
  • migration codegen now expects files to have three digit prefix instead of just lexicographically sorting them
    • if we ever have more than 1000 migrations I think we have a problem, but we can always bump it to four digits..

@Mirko-von-Leipzig Mirko-von-Leipzig added the no changelog This PR does not require an entry in the `CHANGELOG.md` file label May 20, 2026
Comment thread bin/validator/src/db/migrations/001_initial.sql
Comment thread bin/validator/src/db/schema.rs
@Mirko-von-Leipzig Mirko-von-Leipzig changed the title feat(validator): switch to new migration framework feat(validator): port SQLite migration May 20, 2026
Copy link
Copy Markdown
Contributor

@kkovaacs kkovaacs 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 to me!

Copy link
Copy Markdown
Collaborator

@sergerad sergerad left a comment

Choose a reason for hiding this comment

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

LGTM but I don't follow why those 3 byte arrays are now nullable when other ones in the same schema aren't?

@Mirko-von-Leipzig
Copy link
Copy Markdown
Collaborator Author

LGTM but I don't follow why those 3 byte arrays are now nullable when other ones in the same schema aren't?

If you look at the original sqlite for it, they were actually nullable, but the diesel macros for them for whatever reason were altered to be non-null. So when we redid this manually, the more "correct" diesel was generated.

I'll fix the schema to match what we want.

@Mirko-von-Leipzig Mirko-von-Leipzig changed the title feat(validator): port SQLite migration feat: port diesel migrations to the new framework May 21, 2026
@Mirko-von-Leipzig Mirko-von-Leipzig merged commit f31cb55 into next May 21, 2026
21 checks passed
@Mirko-von-Leipzig Mirko-von-Leipzig deleted the mirko/validator-migration branch May 21, 2026 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no changelog This PR does not require an entry in the `CHANGELOG.md` file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants