iamnbutler/shelfgoblinPublic

Shelf Goblin — discover LitRPG audiobooks, follow series, and track your library.

Add database schema and migration system

Implement a migration runner that tracks applied migrations in a
`migrations` table and applies numbered SQL files from
scripts/backend/migrations/ in order, wrapped in transactions.

Create the initial schema (001_initial.sql) with tables for books,
series, book_subgenres, book_sources, fetch_runs, and search_cursors.

`npm run db:migrate` creates the database and applies pending migrations
idempotently. A getMigrationVersion() helper exposes the current version.

Closes #23

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
C4TATasks Agent and Claude Opus 4.6 authored
2acd323Patch
Parent521d101
3 files changed+160-6
StackedSplit
scripts/backend/index.ts+13 −6
scripts/backend/migrate.ts+66 −0
scripts/backend/migrations/001_initial.sql+81 −0