Add SQLite store and embedded migration runner
internal/store opens $MEALQUEST_DATA_DIR/mealquest.db with modernc.org/sqlite (CGO-free) as one writer connection and a read-only pool of four, with busy_timeout=5000, journal_mode=WAL and foreign_keys=ON on every connection. migrations/*.sql are embedded and applied at boot in filename order, each in its own transaction together with its schema_migrations row, so a failing migration rolls back and fails boot. A database holding a version this build does not know is refused. 0001_init.sql is a placeholder until the v1 schema lands. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
-- 0001_init: placeholder so the migrations embed compiles.
|
||||
-- Replaced by the full v1 schema in Feature 02 task 3.
|
||||
@@ -0,0 +1,10 @@
|
||||
// Package migrations embeds the SQL schema migrations applied at boot by
|
||||
// internal/store. Files are named NNNN_slug.sql and applied in filename order.
|
||||
package migrations
|
||||
|
||||
import "embed"
|
||||
|
||||
// FS holds every *.sql migration in this directory.
|
||||
//
|
||||
//go:embed *.sql
|
||||
var FS embed.FS
|
||||
Reference in New Issue
Block a user