Added sub commands for doing admin stuff
This commit is contained in:
parent
329de2f953
commit
4a6b79db17
18 changed files with 531 additions and 185 deletions
|
|
@ -4,10 +4,11 @@ SELECT * FROM publish_targets WHERE site_id = ?;
|
|||
-- name: InsertPublishTarget :one
|
||||
INSERT INTO publish_targets (
|
||||
site_id,
|
||||
guid,
|
||||
target_type,
|
||||
enabled,
|
||||
base_url,
|
||||
target_ref,
|
||||
target_key
|
||||
) VALUES (?, ?, ?, ?, ?, ?)
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?)
|
||||
RETURNING id;
|
||||
|
|
@ -4,6 +4,9 @@ SELECT * FROM sites WHERE owner_id = ? ORDER BY title ASC;
|
|||
-- name: SelectSiteByID :one
|
||||
SELECT * FROM sites WHERE id = ?;
|
||||
|
||||
-- name: SelectSiteByGUID :one
|
||||
SELECT * FROM sites WHERE guid = ?;
|
||||
|
||||
-- name: InsertSite :one
|
||||
INSERT INTO sites (
|
||||
owner_id,
|
||||
|
|
@ -15,4 +18,10 @@ INSERT INTO sites (
|
|||
RETURNING id;
|
||||
|
||||
-- name: HasUsersAndSites :one
|
||||
SELECT (SELECT COUNT(*) FROM users) > 0 AND (SELECT COUNT(*) FROM sites) > 0 AS has_users_and_sites;
|
||||
SELECT (SELECT COUNT(*) FROM users) > 0 AND (SELECT COUNT(*) FROM sites) > 0 AS has_users_and_sites;
|
||||
|
||||
-- name: SelectAllSitesWithOwners :many
|
||||
SELECT s.id, s.guid, s.title, s.owner_id, u.username
|
||||
FROM sites s
|
||||
JOIN users u ON s.owner_id = u.id
|
||||
ORDER BY s.title ASC;
|
||||
Loading…
Add table
Add a link
Reference in a new issue