Initial commot

Have got DB creation and migration working
This commit is contained in:
Leon Mika 2025-01-27 07:39:19 +11:00
commit 4ecc12f035
14 changed files with 315 additions and 0 deletions

6
sql/fs.go Normal file
View file

@ -0,0 +1,6 @@
package sql
import "embed"
//go:embed schema/*.sql
var FS embed.FS

11
sql/queries/sites.sql Normal file
View file

@ -0,0 +1,11 @@
-- name: ListSites :one
SELECT * FROM site;
-- name: NewSite :one
INSERT INTO site (
name,
url,
theme,
props
) VALUES ($1, $2, $3, $4)
RETURNING id;

7
sql/schema/1_init.up.sql Normal file
View file

@ -0,0 +1,7 @@
CREATE TABLE site (
id BIGSERIAL NOT NULL PRIMARY KEY,
name TEXT NOT NULL,
url TEXT NOT NULL,
theme TEXT NOT NULL,
props JSON NOT NULL
);