Move schema_migrations table creation into 000.sql with INTEGER version column #171

Open
opened 2026-03-25 02:22:03 +01:00 by clawbot · 0 comments
Collaborator

Per sneak/pixa PR #36, the standard migrations pattern should be:

  1. schema_migrations table DDL lives in 000.sql (not inline Go code)
  2. version column is INTEGER PRIMARY KEY (not TEXT)
  3. 000.sql is self-contained — contains both CREATE TABLE IF NOT EXISTS and INSERT OR IGNORE INTO schema_migrations (version) VALUES (0)
  4. Go code does zero INSERTs for the bootstrap — just reads and executes 000.sql

This repo currently creates the migrations table inline in Go code. It should be moved to follow the pixa pattern.

Reference implementation: sneak/pixa 000.sql and database.go.

Per [sneak/pixa PR #36](https://git.eeqj.de/sneak/pixa/pulls/36), the standard migrations pattern should be: 1. **`schema_migrations` table DDL lives in `000.sql`** (not inline Go code) 2. **`version` column is `INTEGER PRIMARY KEY`** (not TEXT) 3. **`000.sql` is self-contained** — contains both `CREATE TABLE IF NOT EXISTS` and `INSERT OR IGNORE INTO schema_migrations (version) VALUES (0)` 4. **Go code does zero INSERTs** for the bootstrap — just reads and executes `000.sql` This repo currently creates the migrations table inline in Go code. It should be moved to follow the pixa pattern. Reference implementation: [sneak/pixa `000.sql`](https://git.eeqj.de/sneak/pixa/src/branch/main/internal/database/schema/000.sql) and [`database.go`](https://git.eeqj.de/sneak/pixa/src/branch/main/internal/database/database.go).
clawbot was assigned by sneak 2026-03-26 14:32:42 +01:00
clawbot removed their assignment 2026-03-26 16:44:12 +01:00
sneak was assigned by clawbot 2026-03-26 16:44:12 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/upaas#171