mirror of
https://github.com/therootcompany/golib.git
synced 2026-11-04 15:05: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.
13 lines
396 B
SQL
13 lines
396 B
SQL
-- create-todos (up)
|
|
|
|
CREATE TABLE todos (
|
|
id CHAR(8) PRIMARY KEY,
|
|
title VARCHAR(255) NOT NULL,
|
|
status VARCHAR(20) NOT NULL DEFAULT 'pending',
|
|
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
);
|
|
|
|
-- leave this as the last line
|
|
INSERT INTO _migrations (name, id) VALUES ('2026-04-05-001000_create-todos', 'a1b2c3d4');
|