ldap_backend/db/1_setup.sql

53 lines
No EOL
1.5 KiB
SQL

CREATE TABLE IF NOT EXISTS accounts_wolves (
id_wolves integer PRIMARY KEY,
id_student text,
email text NOT NULL,
expiry text NOT NULL,
name_first text,
name_second text
);
CREATE TABLE IF NOT EXISTS accounts_new (
mail text PRIMARY KEY,
auth_code text NOT NULL,
date_iso text NOT NULL,
date_expiry text NOT NULL,
name_first text NOT NULL,
name_surname text NOT NULL,
id_student text NOT NULL
);
CREATE INDEX IF NOT EXISTS index_auth_code ON accounts_new (auth_code);
CREATE INDEX IF NOT EXISTS index_date_expiry ON accounts_new (date_expiry);
CREATE TABLE IF NOT EXISTS accounts_ssh (
user text PRIMARY KEY,
auth_code text NOT NULL,
email text NOT NULL
);
CREATE TABLE IF NOT EXISTS accounts_reset (
user text PRIMARY KEY,
auth_code text NOT NULL,
date_expiry text NOT NULL
);
CREATE INDEX IF NOT EXISTS index_auth_code ON accounts_reset (auth_code);
CREATE INDEX IF NOT EXISTS index_date_expiry ON accounts_reset (date_expiry);
CREATE TABLE IF NOT EXISTS accounts (
user text PRIMARY KEY,
uid integer NOT NULL,
mail text NOT NULL,
student_id text NOT NULL,
secure integer NOT NULL
);
CREATE INDEX IF NOT EXISTS index_uid_number ON accounts (uid);
CREATE INDEX IF NOT EXISTS index_mail ON accounts (mail);
CREATE INDEX IF NOT EXISTS index_student_id ON accounts (student_id);