Have got publishing to Netlify
This commit is contained in:
parent
8e0ffb6c24
commit
7ef6725bdb
23 changed files with 667 additions and 109 deletions
|
|
@ -1,6 +1,12 @@
|
|||
-- name: ListPosts :many
|
||||
SELECT * FROM post WHERE site_id = $1 ORDER BY post_date DESC LIMIT 25;
|
||||
|
||||
-- name: ListPublishablePosts :many
|
||||
SELECT *
|
||||
FROM post
|
||||
WHERE id > $1 AND site_id = $2 AND state = 'published' AND post_date <= $3
|
||||
ORDER BY id LIMIT 100;
|
||||
|
||||
-- name: InsertPost :one
|
||||
INSERT INTO post (
|
||||
site_id,
|
||||
|
|
|
|||
12
sql/queries/targets.sql
Normal file
12
sql/queries/targets.sql
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
-- name: ListPublishTargetsOfRole :many
|
||||
SELECT * FROM publish_target WHERE site_id = $1 AND role = 'production';
|
||||
|
||||
-- name: InsertPublishTarget :one
|
||||
INSERT INTO publish_target (
|
||||
site_id,
|
||||
role,
|
||||
target_type,
|
||||
url,
|
||||
target_ref
|
||||
) VALUES ($1, $2, $3, $4, $5)
|
||||
RETURNING id;
|
||||
|
|
@ -3,6 +3,14 @@ CREATE TYPE post_state AS ENUM (
|
|||
'published'
|
||||
);
|
||||
|
||||
CREATE TYPE target_role AS ENUM (
|
||||
'production'
|
||||
);
|
||||
|
||||
CREATE TYPE target_type AS ENUM (
|
||||
'netlify'
|
||||
);
|
||||
|
||||
CREATE TABLE site (
|
||||
id BIGSERIAL NOT NULL PRIMARY KEY,
|
||||
name TEXT NOT NULL UNIQUE,
|
||||
|
|
@ -22,5 +30,16 @@ CREATE TABLE post (
|
|||
post_date TIMESTAMP WITH TIME ZONE,
|
||||
created_at TIMESTAMP NOT NULL,
|
||||
|
||||
FOREIGN KEY (site_id) REFERENCES site(id)
|
||||
FOREIGN KEY (site_id) REFERENCES site (id)
|
||||
);
|
||||
|
||||
CREATE TABLE publish_target (
|
||||
id BIGSERIAL NOT NULL PRIMARY KEY,
|
||||
site_id BIGINT NOT NULL,
|
||||
role target_role NOT NULL,
|
||||
target_type target_type NOT NULL,
|
||||
url TEXT NOT NULL,
|
||||
target_ref TEXT NOT NULL,
|
||||
|
||||
FOREIGN KEY (site_id) REFERENCES site (id)
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue