/usr/share/awl/dba/awl-tables.sql is in libawl-php 0.55-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | -- Tables needed for AWL Libraries
BEGIN;
CREATE TABLE supported_locales (
locale TEXT PRIMARY KEY,
locale_name_en TEXT,
locale_name_locale TEXT
);
-- This is the table of users for the system
CREATE TABLE usr (
user_no SERIAL PRIMARY KEY,
active BOOLEAN DEFAULT TRUE,
email_ok TIMESTAMPTZ,
joined TIMESTAMPTZ DEFAULT current_timestamp,
updated TIMESTAMPTZ,
last_used TIMESTAMPTZ,
username TEXT NOT NULL, -- Note UNIQUE INDEX below constains case-insensitive uniqueness
password TEXT,
fullname TEXT,
email TEXT,
config_data TEXT,
date_format_type TEXT DEFAULT 'E', -- default to english date format dd/mm/yyyy
locale TEXT
);
CREATE FUNCTION max_usr() RETURNS INT4 AS 'SELECT max(user_no) FROM usr' LANGUAGE 'sql';
CREATE UNIQUE INDEX usr_sk1_unique_username ON usr ( lower(username) );
CREATE TABLE usr_setting (
user_no INT4 REFERENCES usr ( user_no ) ON DELETE CASCADE,
setting_name TEXT,
setting_value TEXT,
PRIMARY KEY ( user_no, setting_name )
);
CREATE FUNCTION get_usr_setting(INT4,TEXT)
RETURNS TEXT
AS 'SELECT setting_value FROM usr_setting
WHERE usr_setting.user_no = $1
AND usr_setting.setting_name = $2 ' LANGUAGE 'sql';
CREATE TABLE roles (
role_no SERIAL PRIMARY KEY,
role_name TEXT
);
CREATE FUNCTION max_roles() RETURNS INT4 AS 'SELECT max(role_no) FROM roles' LANGUAGE 'sql';
CREATE TABLE role_member (
role_no INT4 REFERENCES roles ( role_no ),
user_no INT4 REFERENCES usr ( user_no ) ON DELETE CASCADE
);
CREATE TABLE session (
session_id SERIAL PRIMARY KEY,
user_no INT4 REFERENCES usr ( user_no ) ON DELETE CASCADE,
session_start TIMESTAMPTZ DEFAULT current_timestamp,
session_end TIMESTAMPTZ DEFAULT current_timestamp,
session_key TEXT,
session_config TEXT
);
CREATE FUNCTION max_session() RETURNS INT4 AS 'SELECT max(session_id) FROM session' LANGUAGE 'sql';
CREATE TABLE tmp_password (
user_no INT4 REFERENCES usr ( user_no ),
password TEXT,
valid_until TIMESTAMPTZ DEFAULT (current_timestamp + '1 day'::interval)
);
COMMIT;
|