From 3fce9b2ff8a0daa043357facbbd961a231bd3c02 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Wed, 16 May 2018 20:55:15 -0700 Subject: simplify SQL schema a bit --- rust/migrations/2018-05-12-001226_init/up.sql | 8 +++++--- rust/src/database_schema.rs | 4 +--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/rust/migrations/2018-05-12-001226_init/up.sql b/rust/migrations/2018-05-12-001226_init/up.sql index 0952cec3..6d8471eb 100644 --- a/rust/migrations/2018-05-12-001226_init/up.sql +++ b/rust/migrations/2018-05-12-001226_init/up.sql @@ -67,11 +67,12 @@ CREATE TABLE container_rev ( -- extra_json JSON, name TEXT NOT NULL, - parent_ident_id BIGINT REFERENCES container_rev(id), publisher TEXT, issn TEXT -- TODO: varchar ); +CREATE INDEX container_rev_issn_idx ON container_rev(issn) WHERE issn IS NOT NULL; + CREATE TABLE container_ident ( id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), is_live BOOL NOT NULL DEFAULT false, @@ -122,8 +123,7 @@ CREATE TABLE release_rev ( work_ident_id UUID NOT NULL, -- FOREIGN KEY; see ALRTER below container_ident_id UUID REFERENCES container_ident(id), title TEXT NOT NULL, - license TEXT, -- TODO: ? - release_type TEXT NOT NULL, -- TODO: enum + release_type TEXT, -- TODO: enum date TEXT, -- XXX: datetime doi TEXT, -- TODO: identifier table? volume TEXT, @@ -131,6 +131,8 @@ CREATE TABLE release_rev ( issue TEXT ); +CREATE INDEX release_rev_doi_idx ON release_rev(doi) WHERE doi IS NOT NULL; + CREATE TABLE release_ident ( id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), is_live BOOL NOT NULL DEFAULT false, diff --git a/rust/src/database_schema.rs b/rust/src/database_schema.rs index 789ed1f3..f355107a 100644 --- a/rust/src/database_schema.rs +++ b/rust/src/database_schema.rs @@ -29,7 +29,6 @@ table! { container_rev (id) { id -> Int8, name -> Text, - parent_ident_id -> Nullable, publisher -> Nullable, issn -> Nullable, } @@ -159,8 +158,7 @@ table! { work_ident_id -> Uuid, container_ident_id -> Nullable, title -> Text, - license -> Nullable, - release_type -> Text, + release_type -> Nullable, date -> Nullable, doi -> Nullable, volume -> Nullable, -- cgit v1.2.3