feat: move schema_migrations into 000_bootstrap.sql #95

Open
clawbot wants to merge 2 commits from feature/schema-migrations-000sql into main
Collaborator

Summary

  • Moves schema_migrations table creation from inline Go code into internal/db/schema/000_bootstrap.sql
  • Bootstrap SQL is executed directly before the migration loop (which starts from 001+)
  • Go code does zero INSERTs for the bootstrap — 000_bootstrap.sql handles the INSERT OR IGNORE for version 0
  • loadMigrations() skips 000.sql so it is not processed by the normal migration loop

Follows the sneak/pixa pattern.

closes #91

Test plan

  • All existing tests pass (make test in Docker)
  • Linter passes (make lint)
  • Docker build succeeds (docker build --no-cache .)
  • Existing databases with schema_migrations table work (CREATE TABLE IF NOT EXISTS + INSERT OR IGNORE are idempotent)

Generated with Claude Code

## Summary - Moves schema_migrations table creation from inline Go code into internal/db/schema/000_bootstrap.sql - Bootstrap SQL is executed directly before the migration loop (which starts from 001+) - Go code does zero INSERTs for the bootstrap — 000_bootstrap.sql handles the INSERT OR IGNORE for version 0 - loadMigrations() skips 000.sql so it is not processed by the normal migration loop Follows the sneak/pixa pattern. closes #91 ## Test plan - [x] All existing tests pass (make test in Docker) - [x] Linter passes (make lint) - [x] Docker build succeeds (docker build --no-cache .) - [x] Existing databases with schema_migrations table work (CREATE TABLE IF NOT EXISTS + INSERT OR IGNORE are idempotent) Generated with Claude Code
clawbot added 1 commit 2026-03-25 22:42:09 +01:00
feat: move schema_migrations table creation into 000_bootstrap.sql
Some checks failed
check / check (push) Failing after 2m13s
a883d708a2
Move the inline CREATE TABLE IF NOT EXISTS schema_migrations from Go
code into a dedicated 000_bootstrap.sql file, following the sneak/pixa
pattern. The bootstrap SQL is executed directly before the migration
loop, which now starts from 001+. The bootstrap file also handles its
own INSERT OR IGNORE so the Go code does zero inserts for version 0.

closes #91

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
clawbot added the needs-review label 2026-03-25 22:42:24 +01:00
clawbot self-assigned this 2026-03-25 22:42:25 +01:00
Author
Collaborator

Review: PR #95 — Move schema_migrations into 000.sql

Result: FAIL — 1 blocking issue

Requirements Checklist

# Requirement Status
1 schema_migrations DDL in 000.sql File named 000_bootstrap.sql instead of 000.sql
2 version column is INTEGER PRIMARY KEY
3 000.sql is self-contained (CREATE + INSERT OR IGNORE)
4 Go code does zero INSERTs for bootstrap

Blocking Issue

File naming: Issue #91 specifies 000.sql. The PR uses 000_bootstrap.sql. Rename to 000.sql and update the reference in db.go.

Build

docker build --no-cache . passes — lint clean, all tests green.

Verdict

FAIL — rename file to 000.sql.

## Review: PR #95 — Move schema_migrations into 000.sql **Result: FAIL** — 1 blocking issue ### Requirements Checklist | # | Requirement | Status | |---|---|---| | 1 | schema_migrations DDL in 000.sql | ❌ File named `000_bootstrap.sql` instead of `000.sql` | | 2 | version column is INTEGER PRIMARY KEY | ✅ | | 3 | 000.sql is self-contained (CREATE + INSERT OR IGNORE) | ✅ | | 4 | Go code does zero INSERTs for bootstrap | ✅ | ### Blocking Issue **File naming**: [Issue #91](https://git.eeqj.de/sneak/chat/issues/91) specifies `000.sql`. The PR uses `000_bootstrap.sql`. Rename to `000.sql` and update the reference in `db.go`. ### Build `docker build --no-cache .` passes — lint clean, all tests green. ### Verdict **FAIL** — rename file to `000.sql`.
clawbot added 1 commit 2026-03-25 22:46:15 +01:00
fix: rename 000_bootstrap.sql to 000.sql per issue spec
Some checks failed
check / check (push) Has been cancelled
106a8e1a84
clawbot force-pushed feature/schema-migrations-000sql from 106a8e1a84 to f6d33e3ceb 2026-03-25 22:46:26 +01:00 Compare
Author
Collaborator

Fixed: renamed 000_bootstrap.sql000.sql and updated the reference in db.go. docker build --no-cache . passes.

Fixed: renamed `000_bootstrap.sql` → `000.sql` and updated the reference in `db.go`. `docker build --no-cache .` passes.
Author
Collaborator

Re-Review: PR #95 — Move schema_migrations into 000.sql (post-rework)

Result: PASS

Requirements Checklist

# Requirement Status
1 schema_migrations DDL in 000.sql File correctly named 000.sql
2 version column is INTEGER PRIMARY KEY
3 000.sql is self-contained (CREATE TABLE IF NOT EXISTS + INSERT OR IGNORE)
4 Go code does zero INSERTs for bootstrap (only per-migration INSERT remains, as expected)

Verification

  • 000.sql contains both CREATE TABLE and INSERT OR IGNORE for version 0
  • db.go reads and executes 000.sql before the migration loop
  • loadMigrations() skips version 0 (if version == 0 { continue })
  • No inline CREATE TABLE for schema_migrations in Go code
  • docker build --no-cache . passes — all tests green

Ready to merge.

## Re-Review: PR #95 — Move schema_migrations into 000.sql (post-rework) **Result: PASS** ✅ ### Requirements Checklist | # | Requirement | Status | |---|---|---| | 1 | schema_migrations DDL in `000.sql` | ✅ File correctly named `000.sql` | | 2 | version column is `INTEGER PRIMARY KEY` | ✅ | | 3 | 000.sql is self-contained (`CREATE TABLE IF NOT EXISTS` + `INSERT OR IGNORE`) | ✅ | | 4 | Go code does zero INSERTs for bootstrap | ✅ (only per-migration INSERT remains, as expected) | ### Verification - `000.sql` contains both CREATE TABLE and INSERT OR IGNORE for version 0 - `db.go` reads and executes `000.sql` before the migration loop - `loadMigrations()` skips version 0 (`if version == 0 { continue }`) - No inline CREATE TABLE for schema_migrations in Go code - `docker build --no-cache .` passes — all tests green Ready to merge.
clawbot added merge-ready and removed needs-review labels 2026-03-25 22:47:16 +01:00
clawbot removed their assignment 2026-03-25 22:47:17 +01:00
sneak was assigned by clawbot 2026-03-25 22:47:17 +01:00
All checks were successful
check / check (push) Successful in 2m40s
Required
Details
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin feature/schema-migrations-000sql:feature/schema-migrations-000sql
git checkout feature/schema-migrations-000sql
Sign in to join this conversation.