From 3d8812fbd0091d2ef636949628c52bf9f48617a6 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Thu, 14 Nov 2024 01:34:29 +0100 Subject: feat(tfstated): implement HTTP basic auth --- pkg/database/sql/000_init.sql | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'pkg/database/sql/000_init.sql') diff --git a/pkg/database/sql/000_init.sql b/pkg/database/sql/000_init.sql index ab40746..c56473f 100644 --- a/pkg/database/sql/000_init.sql +++ b/pkg/database/sql/000_init.sql @@ -2,6 +2,17 @@ CREATE TABLE schema_version ( version INTEGER NOT NULL ) STRICT; +CREATE TABLE accounts ( + id INTEGER PRIMARY KEY, + username TEXT NOT NULL, + password BLOB NOT NULL, + is_admin INTEGER NOT NULL DEFAULT FALSE, + created INTEGER NOT NULL DEFAULT (unixepoch()), + last_login INTEGER NOT NULL DEFAULT (unixepoch()), + settings TEXT +) STRICT; +CREATE UNIQUE INDEX accounts_username on accounts(username); + CREATE TABLE states ( id INTEGER PRIMARY KEY, path TEXT NOT NULL, @@ -11,9 +22,11 @@ CREATE UNIQUE INDEX states_path on states(path); CREATE TABLE versions ( id INTEGER PRIMARY KEY, + account_id INTEGER NOT NULL, state_id INTEGER, data BLOB, lock TEXT, created INTEGER DEFAULT (unixepoch()), + FOREIGN KEY(account_id) REFERENCES accounts(id) ON DELETE CASCADE FOREIGN KEY(state_id) REFERENCES states(id) ON DELETE CASCADE ) STRICT; -- cgit v1.2.3