Skip to content

feat(db): replace inline schema with file-based migration system#234

Merged
Petah1 merged 2 commits into
scout-off:mainfrom
Damidesign:feat/db-migration-system
Jun 23, 2026
Merged

feat(db): replace inline schema with file-based migration system#234
Petah1 merged 2 commits into
scout-off:mainfrom
Damidesign:feat/db-migration-system

Conversation

@Damidesign

Copy link
Copy Markdown
Contributor

this pr closes #224
Introduces src/db/migrate.ts which reads db/*.sql files in lexicographic order, skips already-applied migrations recorded in a migrations table, and runs each new file in a transaction. Removes the inline db.exec() schema creation from initDb() so db/001_initial.sql is the single source of truth. Adds idempotency tests and updates the better-sqlite3 mock to support the migrations table.

Introduces src/db/migrate.ts which reads db/*.sql files in lexicographic
order, skips already-applied migrations recorded in a migrations table,
and runs each new file in a transaction. Removes the inline db.exec()
schema creation from initDb() so db/001_initial.sql is the single source
of truth. Adds idempotency tests and updates the better-sqlite3 mock to
support the migrations table.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Petah1

Petah1 commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

fix ci

@Petah1 Petah1 merged commit db32605 into scout-off:main Jun 23, 2026
@grantfox-oss grantfox-oss Bot mentioned this pull request Jun 23, 2026
2 tasks
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 database migration runner

2 participants