dev: automated commit - 2025-08-10 18:18:05

This commit is contained in:
Mariano Z. 2025-08-10 18:18:05 -03:00
parent 47fb2fb928
commit 81967b4d8e
13 changed files with 438 additions and 53 deletions

View file

@ -1,3 +1,4 @@
-- db/queries.sql
-- name: GetConfig :one
SELECT * FROM config LIMIT 1;
@ -25,7 +26,26 @@ CREATE TABLE IF NOT EXISTS config (
update_period TEXT NOT NULL DEFAULT '0 */6 * * *'
);
CREATE TABLE IF NOT EXISTS static_records (
record_id TEXT PRIMARY KEY,
record_name TEXT NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
-- Insert default config if none exists
INSERT OR IGNORE INTO config (api_token, zone_id, domain, update_period)
SELECT '', '', 'mz.uy', '0 */6 * * *'
WHERE NOT EXISTS (SELECT 1 FROM config);
-- name: AddStaticRecord :exec
INSERT OR REPLACE INTO static_records (record_id, record_name)
VALUES (?, ?);
-- name: RemoveStaticRecord :exec
DELETE FROM static_records WHERE record_id = ?;
-- name: GetStaticRecords :many
SELECT record_id, record_name FROM static_records;
-- name: IsStaticRecord :one
SELECT CAST(EXISTS(SELECT 1 FROM static_records WHERE record_id = ?) AS BOOLEAN) AS is_static;