aboutsummaryrefslogtreecommitdiffstats
path: root/rust
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-05-16 20:55:15 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-05-16 20:55:15 -0700
commit3fce9b2ff8a0daa043357facbbd961a231bd3c02 (patch)
tree558fe0c743246b550671d4f5cc9f7130b04cf87e /rust
parent39456677cdc9768ad0dea76be4fd36735eec3ed2 (diff)
downloadfatcat-3fce9b2ff8a0daa043357facbbd961a231bd3c02.tar.gz
fatcat-3fce9b2ff8a0daa043357facbbd961a231bd3c02.zip
simplify SQL schema a bit
Diffstat (limited to 'rust')
-rw-r--r--rust/migrations/2018-05-12-001226_init/up.sql8
-rw-r--r--rust/src/database_schema.rs4
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<Int8>,
publisher -> Nullable<Text>,
issn -> Nullable<Text>,
}
@@ -159,8 +158,7 @@ table! {
work_ident_id -> Uuid,
container_ident_id -> Nullable<Uuid>,
title -> Text,
- license -> Nullable<Text>,
- release_type -> Text,
+ release_type -> Nullable<Text>,
date -> Nullable<Text>,
doi -> Nullable<Text>,
volume -> Nullable<Text>,