Fixed site ownership
This commit is contained in:
parent
cb54057305
commit
50f7e9632e
20 changed files with 192 additions and 78 deletions
|
|
@ -9,8 +9,7 @@ INSERT INTO sites (
|
|||
name,
|
||||
owner_user_id,
|
||||
title,
|
||||
url,
|
||||
theme,
|
||||
props
|
||||
) VALUES ($1, $2, $3, $4, $5, $6)
|
||||
) VALUES ($1, $2, $3, $4, $5)
|
||||
RETURNING id;
|
||||
|
|
@ -1,5 +1,8 @@
|
|||
-- name: ListPublishTargetsOfRole :many
|
||||
SELECT * FROM publish_targets WHERE site_id = $1 AND role = 'production';
|
||||
-- name: ListTargetsOfSite :many
|
||||
SELECT * FROM publish_targets WHERE site_id = $1;
|
||||
|
||||
-- name: GetTargetOfSiteRole :one
|
||||
SELECT * FROM publish_targets WHERE site_id = $1 AND role = $2 LIMIT 1;
|
||||
|
||||
-- name: InsertPublishTarget :one
|
||||
INSERT INTO publish_targets (
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ CREATE TABLE sites (
|
|||
owner_user_id BIGINT NOT NULL,
|
||||
name TEXT NOT NULL UNIQUE,
|
||||
title TEXT NOT NULL,
|
||||
url TEXT NOT NULL,
|
||||
theme TEXT NOT NULL,
|
||||
props JSON NOT NULL,
|
||||
|
||||
|
|
@ -50,5 +49,6 @@ CREATE TABLE publish_targets (
|
|||
url TEXT NOT NULL,
|
||||
target_ref TEXT NOT NULL,
|
||||
|
||||
FOREIGN KEY (site_id) REFERENCES sites (id) ON DELETE CASCADE
|
||||
FOREIGN KEY (site_id) REFERENCES sites (id) ON DELETE CASCADE,
|
||||
UNIQUE (site_id, role)
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue