aboutsummaryrefslogtreecommitdiffstats
path: root/rust/migrations
diff options
context:
space:
mode:
Diffstat (limited to 'rust/migrations')
-rw-r--r--rust/migrations/2018-05-12-001226_init/down.sql1
-rw-r--r--rust/migrations/2018-05-12-001226_init/up.sql12
2 files changed, 13 insertions, 0 deletions
diff --git a/rust/migrations/2018-05-12-001226_init/down.sql b/rust/migrations/2018-05-12-001226_init/down.sql
index d156370e..b2666083 100644
--- a/rust/migrations/2018-05-12-001226_init/down.sql
+++ b/rust/migrations/2018-05-12-001226_init/down.sql
@@ -42,6 +42,7 @@ DROP TABLE IF EXISTS creator_ident CASCADE;
DROP TABLE IF EXISTS creator_edit CASCADE;
DROP TABLE IF EXISTS abstracts CASCADE;
+DROP TABLE IF EXISTS auth_oidc CASCADE;
DROP TABLE IF EXISTS editor CASCADE;
DROP TABLE IF EXISTS editgroup CASCADE;
DROP TABLE IF EXISTS changelog CASCADE;
diff --git a/rust/migrations/2018-05-12-001226_init/up.sql b/rust/migrations/2018-05-12-001226_init/up.sql
index db2e835f..0d9d81d0 100644
--- a/rust/migrations/2018-05-12-001226_init/up.sql
+++ b/rust/migrations/2018-05-12-001226_init/up.sql
@@ -19,6 +19,7 @@ CREATE TABLE editor (
username TEXT NOT NULL UNIQUE, -- TODO: alphanum and length constraints?
is_admin BOOLEAN NOT NULL DEFAULT false,
is_bot BOOLEAN NOT NULL DEFAULT false,
+ is_active BOOLEAN NOT NULL DEFAULT true,
registered TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL,
auth_epoch TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL,
wrangler_id UUID REFERENCES editor(id),
@@ -28,6 +29,17 @@ CREATE TABLE editor (
CREATE INDEX active_editgroup_idx ON editor(active_editgroup_id);
CREATE INDEX editor_username_idx ON editor(username);
+CREATE TABLE auth_oidc (
+ id BIGSERIAL PRIMARY KEY,
+ created TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL,
+ editor_id UUID REFERENCES editor(id) NOT NULL,
+ provider TEXT NOT NULL,
+ oidc_iss TEXT NOT NULL,
+ oidc_sub TEXT NOT NULL,
+ UNIQUE (editor_id, provider),
+ UNIQUE (oidc_iss, oidc_sub)
+);
+
CREATE TABLE editgroup (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
editor_id UUID REFERENCES editor(id) NOT NULL,