Skip to content

Add lightweight database migration system#48

Merged
Aaronontheweb merged 1 commit intodevfrom
feature/schema-migrations
Apr 27, 2026
Merged

Add lightweight database migration system#48
Aaronontheweb merged 1 commit intodevfrom
feature/schema-migrations

Conversation

@Aaronontheweb
Copy link
Copy Markdown
Contributor

Summary

  • Adds SchemaMigrator (static class) that applies numbered .sql migration files from a migrations/ directory on startup, tracking applied versions in a schema_version table
  • Moves existing inline schema from DatabaseInitializer.cs into migrations/001_initial_schema.sql — existing databases are handled safely via IF NOT EXISTS clauses
  • Follows the Memorizer SchemaMigrator pattern, adapted for SQLite

Closes #44

Test plan

  • dotnet build -c Release — 0 warnings
  • dotnet test -c Release — all 67 tests pass (48 unit + 19 integration)
  • scripts/Add-FileHeaders.ps1 -Verify — all headers present
  • dotnet slopwatch analyze — 0 issues
  • CI passes on ubuntu + windows

Replace inline schema constant in DatabaseInitializer with numbered SQL
migration files and a SchemaMigrator that tracks applied versions in a
schema_version table. Existing databases are handled safely via
IF NOT EXISTS clauses in migration 001.
@Aaronontheweb Aaronontheweb merged commit aa691fe into dev Apr 27, 2026
5 checks passed
@Aaronontheweb Aaronontheweb deleted the feature/schema-migrations branch April 27, 2026 21: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.

Add lightweight database migration system

1 participant