mirror of
https://github.com/therootcompany/golib.git
synced 2026-11-04 06:55:00 +00:00
Example CLI todo app demonstrating sqlmigrate + pgmigrate for running migrations directly via pgx/v5 instead of shelling out to psql. Uses embed.FS for migration files, auto-migrates on startup, and includes full CRUD for todos and folders with sqlc-ready query files.
11 lines
304 B
SQL
11 lines
304 B
SQL
-- init-migrations (up)
|
|
|
|
CREATE TABLE IF NOT EXISTS _migrations (
|
|
id CHAR(8) PRIMARY KEY,
|
|
name VARCHAR(80) NULL UNIQUE,
|
|
applied_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
);
|
|
|
|
-- leave this as the last line
|
|
INSERT INTO _migrations (name, id) VALUES ('0001-01-01-001000_init-migrations', '00000001');
|