Initial commot
Have got DB creation and migration working
This commit is contained in:
commit
4ecc12f035
14 changed files with 315 additions and 0 deletions
6
sql/fs.go
Normal file
6
sql/fs.go
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
package sql
|
||||
|
||||
import "embed"
|
||||
|
||||
//go:embed schema/*.sql
|
||||
var FS embed.FS
|
||||
11
sql/queries/sites.sql
Normal file
11
sql/queries/sites.sql
Normal 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
7
sql/schema/1_init.up.sql
Normal 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
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue