From 9c45e4fd70ed83bd2c203da225777ad670c2c15c Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Mon, 22 Apr 2024 18:48:16 +0200 Subject: Initial commit --- sql/schema.sql | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 sql/schema.sql (limited to 'sql') diff --git a/sql/schema.sql b/sql/schema.sql new file mode 100644 index 0000000..76916c1 --- /dev/null +++ b/sql/schema.sql @@ -0,0 +1,34 @@ +-- Schema and table definitions for faktura +-- +-- SPDX-FileCopyrightText: 2024 Eilertsens Kodeknekkeri +-- SPDX-FileCopyrightText: 2024 Harald Eilertsen +-- +-- SPDX-License-Identifier: AGPL-3.0-or-later + +create schema api; + +create table api.clients ( + id serial primary key, + name text not null, + contact text, + email text not null, + phone text, + address text, + vat boolean +); + +-- Set up web user for anonymous requests +create role web_anon nologin; +grant usage on schema api to web_anon; +grant select on api.clients to web_anon; + +-- Set up trusted user for modifications +create role faktura_user nologin; +grant usage on schema api to faktura_user; +grant all on api.clients to faktura_user; +grant usage, select on sequence api.clients_id_seq to faktura_user; + +-- Set up authenticator user for db login +create role authenticator noinherit login password 'password'; +grant web_anon to authenticator; +grant faktura_user to authenticator; -- cgit v1.2.3