aboutsummaryrefslogtreecommitdiffstats
path: root/rust/migrations
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/migrations
parent39456677cdc9768ad0dea76be4fd36735eec3ed2 (diff)
downloadfatcat-3fce9b2ff8a0daa043357facbbd961a231bd3c02.tar.gz
fatcat-3fce9b2ff8a0daa043357facbbd961a231bd3c02.zip
simplify SQL schema a bit
Diffstat (limited to 'rust/migrations')
-rw-r--r--rust/migrations/2018-05-12-001226_init/up.sql8
1 files changed, 5 insertions, 3 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,