mirror of
https://github.com/acaloiaro/frm
synced 2026-07-21 10:12:23 +00:00
19 lines
366 B
SQL
19 lines
366 B
SQL
-- name: ListForm :many
|
|
|
|
SELECT *
|
|
FROM forms;
|
|
|
|
-- name: GetForm :one
|
|
|
|
SELECT *
|
|
FROM forms
|
|
WHERE id = @id;
|
|
|
|
-- name: SaveForm :one
|
|
|
|
INSERT INTO forms (id, name, fields)
|
|
VALUES (coalesce(nullif(@id, 0), nextval('form_ids'))::bigint, @name, @fields) ON conflict(id) DO
|
|
UPDATE
|
|
SET updated_at = timezone('utc', now()),
|
|
name = @name,
|
|
fields = @fields RETURNING *;
|