summaryrefslogtreecommitdiffstats
path: root/rust/migrations/2018-05-12-001226_init
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-07-23 21:52:06 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-07-23 21:54:12 -0700
commitaefd4ee331bff35141f3346abaac9e53d4517344 (patch)
treec7f70ac6bea716d20d1b6a5356caea533d8663d8 /rust/migrations/2018-05-12-001226_init
parent6f9fb12f93d9ab628cbef781a2480f0483b8f470 (diff)
downloadfatcat-aefd4ee331bff35141f3346abaac9e53d4517344.tar.gz
fatcat-aefd4ee331bff35141f3346abaac9e53d4517344.zip
bunch of SQL updates
- file urls as a table - more external identifiers (eg, pmcid, wikidata) - release ref and contrib mostly as JSON - abstracts - timestamps - fixed size external identifiers (CHAR not TEXT)
Diffstat (limited to 'rust/migrations/2018-05-12-001226_init')
-rw-r--r--rust/migrations/2018-05-12-001226_init/up.sql153
1 files changed, 105 insertions, 48 deletions
diff --git a/rust/migrations/2018-05-12-001226_init/up.sql b/rust/migrations/2018-05-12-001226_init/up.sql
index eb83d6c6..297dde13 100644
--- a/rust/migrations/2018-05-12-001226_init/up.sql
+++ b/rust/migrations/2018-05-12-001226_init/up.sql
@@ -12,13 +12,15 @@ CREATE TABLE editor (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
username TEXT NOT NULL UNIQUE,
is_admin BOOLEAN NOT NULL DEFAULT false,
+ registered TIMESTAMP WITHOUT TIME ZONE DEFAULT now() NOT NULL,
active_editgroup_id UUID -- REFERENCES( editgroup(id) via ALTER below
);
CREATE TABLE editgroup (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
- extra_json JSON,
editor_id UUID REFERENCES editor(id) NOT NULL,
+ created TIMESTAMP WITHOUT TIME ZONE DEFAULT now() NOT NULL,
+ extra_json JSON,
description TEXT
);
@@ -35,6 +37,11 @@ CREATE TABLE changelog (
-- for "is this editgroup merged" queries
CREATE INDEX changelog_editgroup_idx ON changelog(editgroup_id);
+CREATE TABLE abstracts (
+ sha1 CHAR(40) PRIMARY KEY,
+ content TEXT NOT NULL
+);
+
-------------------- Creators -----------------------------------------------
CREATE TABLE creator_rev (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
@@ -43,7 +50,9 @@ CREATE TABLE creator_rev (
display_name TEXT NOT NULL,
given_name TEXT,
surname TEXT,
- orcid TEXT
+ orcid CHAR(19),
+ wikidata_qid TEXT
+ -- TODO: viaf TEXT,
-- TODO: aliases/alternatives
-- TODO: sortable name?
);
@@ -51,6 +60,7 @@ CREATE TABLE creator_rev (
-- Could denormalize a "is_live" flag into revision tables, to make indices
-- more efficient
CREATE INDEX creator_rev_orcid_idx ON creator_rev(orcid) WHERE orcid IS NOT NULL;
+CREATE INDEX creator_rev_wikidata_idx ON creator_rev(wikidata_qid) WHERE wikidata_qid IS NOT NULL;
CREATE TABLE creator_ident (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
@@ -64,9 +74,11 @@ CREATE INDEX creator_ident_rev_idx ON creator_ident(rev_id);
CREATE TABLE creator_edit (
id BIGSERIAL PRIMARY KEY,
editgroup_id UUID REFERENCES editgroup(id) NOT NULL,
+ updated TIMESTAMP WITHOUT TIME ZONE DEFAULT now() NOT NULL,
ident_id UUID REFERENCES creator_ident(id) NOT NULL,
rev_id UUID REFERENCES creator_rev(id),
redirect_id UUID REFERENCES creator_ident(id),
+ prev_rev UUID REFERENCES creator_rev(id),
extra_json JSON
);
@@ -79,12 +91,14 @@ CREATE TABLE container_rev (
name TEXT NOT NULL,
publisher TEXT,
- issnl TEXT, -- TODO: varchar
+ issnl CHAR(9),
+ wikidata_qid TEXT,
abbrev TEXT,
coden TEXT
);
CREATE INDEX container_rev_issnl_idx ON container_rev(issnl) WHERE issnl IS NOT NULL;
+CREATE INDEX container_rev_wikidata_idx ON container_rev(wikidata_qid) WHERE wikidata_qid IS NOT NULL;
CREATE TABLE container_ident (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
@@ -97,10 +111,12 @@ CREATE INDEX container_ident_rev_idx ON container_ident(rev_id);
CREATE TABLE container_edit (
id BIGSERIAL PRIMARY KEY,
+ created TIMESTAMP WITHOUT TIME ZONE DEFAULT now() NOT NULL,
editgroup_id UUID REFERENCES editgroup(id) NOT NULL,
ident_id UUID REFERENCES container_ident(id) NOT NULL,
rev_id UUID REFERENCES container_rev(id),
redirect_id UUID REFERENCES container_ident(id),
+ prev_rev UUID REFERENCES container_rev(id),
extra_json JSON
);
@@ -112,10 +128,9 @@ CREATE TABLE file_rev (
extra_json JSON,
size BIGINT,
- sha1 TEXT, -- TODO: varchar or bytes
- sha256 TEXT, -- TODO: varchar or bytes
- md5 TEXT, -- TODO: varchar or bytes
- url TEXT, -- TODO: URL table
+ sha1 CHAR(40),
+ sha256 CHAR(64),
+ md5 CHAR(32),
mimetype TEXT
);
@@ -123,6 +138,13 @@ CREATE INDEX file_rev_sha1_idx ON file_rev(sha1) WHERE sha1 IS NOT NULL;
CREATE INDEX file_rev_md5_idx ON file_rev(md5) WHERE md5 IS NOT NULL;
CREATE INDEX file_rev_sha256_idx ON file_rev(sha256) WHERE sha256 IS NOT NULL;
+CREATE TABLE file_rev_url (
+ id BIGSERIAL PRIMARY KEY,
+ file_rev UUID REFERENCES file_rev(id) NOT NULL,
+ rel TEXT NOT NULL, -- TODO: enum? web, webarchive, repo, etc
+ url TEXT NOT NULL
+);
+
CREATE TABLE file_ident (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
is_live BOOL NOT NULL DEFAULT false,
@@ -134,10 +156,12 @@ CREATE INDEX file_ident_rev_idx ON file_ident(rev_id);
CREATE TABLE file_edit (
id BIGSERIAL PRIMARY KEY,
+ updated TIMESTAMP WITHOUT TIME ZONE DEFAULT now() NOT NULL,
editgroup_id UUID REFERENCES editgroup(id) NOT NULL,
ident_id UUID REFERENCES file_ident(id) NOT NULL,
rev_id UUID REFERENCES file_rev(id),
redirect_id UUID REFERENCES file_ident(id),
+ prev_rev UUID REFERENCES file_rev(id),
extra_json JSON
);
@@ -155,19 +179,34 @@ CREATE TABLE release_rev (
release_status TEXT, -- TODO: enum
release_date DATE,
doi TEXT,
- isbn13 TEXT,
+ pmid TEXT, -- TODO: BIGINT?
+ pmcid TEXT, -- TODO: BIGINT?
+ wikidata_qid TEXT, -- TODO: BIGINT?
+ isbn13 TEXT, -- TODO: fixed-length
volume TEXT,
issue TEXT,
pages TEXT,
publisher TEXT, -- for books, NOT if container exists
language TEXT -- primary language of the work's fulltext; RFC1766/ISO639-1
+ -- TODO: oclc_ocn (TEXT or BIGINT)
-- TODO: identifier table?
);
CREATE INDEX release_rev_doi_idx ON release_rev(doi) WHERE doi IS NOT NULL;
+CREATE INDEX release_rev_pmid_idx ON release_rev(pmid) WHERE pmid IS NOT NULL;
+CREATE INDEX release_rev_pmcid_idx ON release_rev(pmcid) WHERE pmcid IS NOT NULL;
+CREATE INDEX release_rev_wikidata_idx ON release_rev(wikidata_qid) WHERE wikidata_qid IS NOT NULL;
CREATE INDEX release_rev_isbn13_idx ON release_rev(isbn13) WHERE isbn13 IS NOT NULL;
CREATE INDEX release_rev_work_idx ON release_rev(work_ident_id) WHERE work_ident_id IS NOT NULL;
+CREATE TABLE release_rev_abstracts (
+ id BIGSERIAL PRIMARY KEY,
+ release_rev UUID REFERENCES release_rev(id) NOT NULL,
+ abstract_sha1 CHAR(40) REFERENCES abstracts(sha1) NOT NULL,
+ mimetype TEXT,
+ lang TEXT
+);
+
CREATE TABLE release_ident (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
is_live BOOL NOT NULL DEFAULT false,
@@ -179,10 +218,12 @@ CREATE INDEX release_ident_rev_idx ON release_ident(rev_id);
CREATE TABLE release_edit (
id BIGSERIAL PRIMARY KEY,
+ updated TIMESTAMP WITHOUT TIME ZONE DEFAULT now() NOT NULL,
editgroup_id UUID REFERENCES editgroup(id) NOT NULL,
ident_id UUID REFERENCES release_ident(id) NOT NULL,
rev_id UUID REFERENCES release_rev(id),
redirect_id UUID REFERENCES release_ident(id),
+ prev_rev UUID REFERENCES release_rev(id),
extra_json JSON
);
@@ -191,7 +232,7 @@ CREATE INDEX release_edit_idx ON release_edit(editgroup_id);
-------------------- Works --------------------------------------------------
CREATE TABLE work_rev (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
- extra_json JSON,
+ extra_json JSON
);
CREATE TABLE work_ident (
@@ -205,10 +246,12 @@ CREATE INDEX work_ident_rev_idx ON work_ident(rev_id);
CREATE TABLE work_edit (
id BIGSERIAL PRIMARY KEY,
+ updated TIMESTAMP WITHOUT TIME ZONE DEFAULT now() NOT NULL,
editgroup_id UUID REFERENCES editgroup(id) NOT NULL,
ident_id UUID REFERENCES work_ident(id) NOT NULL,
rev_id UUID REFERENCES work_rev(id),
redirect_id UUID REFERENCES work_ident(id),
+ prev_rev UUID REFERENCES work_rev(id),
extra_json JSON
);
@@ -224,9 +267,10 @@ CREATE TABLE release_contrib (
id BIGSERIAL PRIMARY KEY,
release_rev UUID REFERENCES release_rev(id) NOT NULL,
creator_ident_id UUID REFERENCES creator_ident(id),
+ raw TEXT,
role TEXT, -- TODO: enum?
index BIGINT,
- raw TEXT
+ extra_json JSON
);
CREATE INDEX release_contrib_rev_idx ON release_contrib(release_rev);
@@ -238,11 +282,12 @@ CREATE TABLE release_ref (
target_release_ident_id UUID REFERENCES release_ident(id), -- or work?
index BIGINT,
key TEXT,
- raw TEXT,
+ extra_json JSON, -- title, year, container_title, locator (aka, page)
container_title TEXT,
year BIGINT,
title TEXT,
locator TEXT
+ -- TODO: oci_id (TEXT)
);
CREATE INDEX release_ref_rev_idx ON release_ref(release_rev);
@@ -291,6 +336,10 @@ INSERT INTO changelog (editgroup_id) VALUES
('00000000-0000-0000-BBBB-000000000004'),
('00000000-0000-0000-BBBB-000000000005');
+INSERT INTO abstracts (sha1, content) VALUES
+ ('1ba86bf8c2979a62d29b18b537e50b2b093be27e', 'some long abstract in plain text'),
+ ('0da908ab584b5e445a06beb172e3fab8cb5169e3', '<jats>A longer, more correct abstract should in theory go here</jats>');
+
INSERT INTO container_rev (id, name, publisher, issnl, abbrev, coden, extra_json) VALUES
('00000000-0000-0000-1111-FFF000000001', 'MySpace Blog', null, null, null, null, null),
('00000000-0000-0000-1111-FFF000000002', 'Journal of Trivial Results', 'bogus publishing group', '1234-5678', 'Triv. Res.', 'CDNXYZ', '{"is_oa": false, "in_doaj": false}'),
@@ -301,15 +350,15 @@ INSERT INTO container_ident (id, is_live, rev_id, redirect_id) VALUES
('00000000-0000-0000-1111-000000000002', true, '00000000-0000-0000-1111-FFF000000002', null), -- aaaaaaaaaaaaaeiraaaaaaaaai
('00000000-0000-0000-1111-000000000003', true, '00000000-0000-0000-1111-FFF000000003', null); -- aaaaaaaaaaaaaeiraaaaaaaaam
-INSERT INTO container_edit (ident_id, rev_id, redirect_id, editgroup_id) VALUES
- ('00000000-0000-0000-1111-000000000001', '00000000-0000-0000-1111-FFF000000001', null, '00000000-0000-0000-BBBB-000000000003'),
- ('00000000-0000-0000-1111-000000000002', '00000000-0000-0000-1111-FFF000000002', null, '00000000-0000-0000-BBBB-000000000004'),
- ('00000000-0000-0000-1111-000000000003', '00000000-0000-0000-1111-FFF000000003', null, '00000000-0000-0000-BBBB-000000000005');
+INSERT INTO container_edit (ident_id, rev_id, redirect_id, editgroup_id, prev_rev) VALUES
+ ('00000000-0000-0000-1111-000000000001', '00000000-0000-0000-1111-FFF000000001', null, '00000000-0000-0000-BBBB-000000000003', null),
+ ('00000000-0000-0000-1111-000000000002', '00000000-0000-0000-1111-FFF000000002', null, '00000000-0000-0000-BBBB-000000000004', null),
+ ('00000000-0000-0000-1111-000000000003', '00000000-0000-0000-1111-FFF000000003', null, '00000000-0000-0000-BBBB-000000000005', '00000000-0000-0000-1111-FFF000000002');
-INSERT INTO creator_rev (id, display_name, given_name, surname, orcid) VALUES
- ('00000000-0000-0000-2222-FFF000000001', 'Grace Hopper', null, null, null),
- ('00000000-0000-0000-2222-FFF000000002', 'Christine Moran', 'Christine', 'Moran', '0000-0003-2088-7465'),
- ('00000000-0000-0000-2222-FFF000000003', 'John P. A. Ioannidis', 'John', 'Ioannidis', '0000-0003-3118-6859');
+INSERT INTO creator_rev (id, display_name, given_name, surname, orcid, wikidata_qid) VALUES
+ ('00000000-0000-0000-2222-FFF000000001', 'Grace Hopper', null, null, null, null),
+ ('00000000-0000-0000-2222-FFF000000002', 'Christine Moran', 'Christine', 'Moran', '0000-0003-2088-7465', 'Q1234'),
+ ('00000000-0000-0000-2222-FFF000000003', 'John P. A. Ioannidis', 'John', 'Ioannidis', '0000-0003-3118-6859', 'Q5678');
INSERT INTO creator_ident (id, is_live, rev_id, redirect_id) VALUES
('00000000-0000-0000-2222-000000000001', true, '00000000-0000-0000-2222-FFF000000001', null), -- aaaaaaaaaaaaaircaaaaaaaaae
@@ -317,26 +366,30 @@ INSERT INTO creator_ident (id, is_live, rev_id, redirect_id) VALUES
('00000000-0000-0000-2222-000000000003', true, '00000000-0000-0000-2222-FFF000000003', null), -- aaaaaaaaaaaaaircaaaaaaaaam
('00000000-0000-0000-2222-000000000004', false, '00000000-0000-0000-2222-FFF000000002', null); -- aaaaaaaaaaaaaircaaaaaaaaaq
-INSERT INTO creator_edit (ident_id, rev_id, redirect_id, editgroup_id) VALUES
- ('00000000-0000-0000-2222-000000000001', '00000000-0000-0000-2222-FFF000000001', null, '00000000-0000-0000-BBBB-000000000001'),
- ('00000000-0000-0000-2222-000000000002', '00000000-0000-0000-2222-FFF000000002', null, '00000000-0000-0000-BBBB-000000000002'),
- ('00000000-0000-0000-2222-000000000003', '00000000-0000-0000-2222-FFF000000003', null, '00000000-0000-0000-BBBB-000000000003'),
- ('00000000-0000-0000-2222-000000000004', '00000000-0000-0000-2222-FFF000000002', null, '00000000-0000-0000-BBBB-000000000004');
+INSERT INTO creator_edit (ident_id, rev_id, redirect_id, editgroup_id, prev_rev) VALUES
+ ('00000000-0000-0000-2222-000000000001', '00000000-0000-0000-2222-FFF000000001', null, '00000000-0000-0000-BBBB-000000000001', null),
+ ('00000000-0000-0000-2222-000000000002', '00000000-0000-0000-2222-FFF000000002', null, '00000000-0000-0000-BBBB-000000000002', null),
+ ('00000000-0000-0000-2222-000000000003', '00000000-0000-0000-2222-FFF000000003', null, '00000000-0000-0000-BBBB-000000000003', null),
+ ('00000000-0000-0000-2222-000000000004', '00000000-0000-0000-2222-FFF000000002', null, '00000000-0000-0000-BBBB-000000000004', '00000000-0000-0000-2222-FFF000000003');
+
+INSERT INTO file_rev (id, size, sha1, sha256, md5, mimetype) VALUES
+ ('00000000-0000-0000-3333-FFF000000001', null, null, null, null, null),
+ ('00000000-0000-0000-3333-FFF000000002', 4321, '7d97e98f8af710c7e7fe703abc8f639e0ee507c4', null, null, 'text/plain'),
+ ('00000000-0000-0000-3333-FFF000000003', 255629, '3f242a192acc258bdfdb151943419437f440c313', 'ffc1005680cb620eec4c913437dfabbf311b535cfe16cbaeb2faec1f92afc362', 'f4de91152c7ab9fdc2a128f962faebff', 'application/pdf');
-INSERT INTO file_rev (id, size, sha1, sha256, md5, url, mimetype) VALUES
- ('00000000-0000-0000-3333-FFF000000001', null, null, null, null, null, null),
- ('00000000-0000-0000-3333-FFF000000002', 4321, '7d97e98f8af710c7e7fe703abc8f639e0ee507c4', null, null, 'http://archive.org/robots.txt', 'text/plain'),
- ('00000000-0000-0000-3333-FFF000000003', 255629, '3f242a192acc258bdfdb151943419437f440c313', 'ffc1005680cb620eec4c913437dfabbf311b535cfe16cbaeb2faec1f92afc362', 'f4de91152c7ab9fdc2a128f962faebff', 'http://journals.plos.org/plosmedicine/article/file?id=10.1371/journal.pmed.0020124&type=printable', 'application/pdf');
+INSERT INTO file_rev_url (file_rev, rel, url) VALUES
+ ('00000000-0000-0000-3333-FFF000000002', 'web', 'http://archive.org/robots.txt'),
+ ('00000000-0000-0000-3333-FFF000000003', 'publisher', 'http://journals.plos.org/plosmedicine/article/file?id=10.1371/journal.pmed.0020124&type=printable');
INSERT INTO file_ident (id, is_live, rev_id, redirect_id) VALUES
('00000000-0000-0000-3333-000000000001', true, '00000000-0000-0000-3333-FFF000000001', null), -- aaaaaaaaaaaaamztaaaaaaaaae
('00000000-0000-0000-3333-000000000002', true, '00000000-0000-0000-3333-FFF000000002', null), -- aaaaaaaaaaaaamztaaaaaaaaai
('00000000-0000-0000-3333-000000000003', true, '00000000-0000-0000-3333-FFF000000003', null); -- aaaaaaaaaaaaamztaaaaaaaaam
-INSERT INTO file_edit (ident_id, rev_id, redirect_id, editgroup_id) VALUES
- ('00000000-0000-0000-3333-000000000001', '00000000-0000-0000-3333-FFF000000001', null, '00000000-0000-0000-BBBB-000000000003'),
- ('00000000-0000-0000-3333-000000000002', '00000000-0000-0000-3333-FFF000000002', null, '00000000-0000-0000-BBBB-000000000004'),
- ('00000000-0000-0000-3333-000000000003', '00000000-0000-0000-3333-FFF000000003', null, '00000000-0000-0000-BBBB-000000000005');
+INSERT INTO file_edit (ident_id, rev_id, redirect_id, editgroup_id, prev_rev) VALUES
+ ('00000000-0000-0000-3333-000000000001', '00000000-0000-0000-3333-FFF000000001', null, '00000000-0000-0000-BBBB-000000000003', null),
+ ('00000000-0000-0000-3333-000000000002', '00000000-0000-0000-3333-FFF000000002', null, '00000000-0000-0000-BBBB-000000000004', null),
+ ('00000000-0000-0000-3333-000000000003', '00000000-0000-0000-3333-FFF000000003', null, '00000000-0000-0000-BBBB-000000000005', '00000000-0000-0000-3333-FFF000000002');
INSERT INTO work_rev (id) VALUES
('00000000-0000-0000-5555-FFF000000001'),
@@ -348,10 +401,10 @@ INSERT INTO work_ident (id, is_live, rev_id, redirect_id) VALUES
('00000000-0000-0000-5555-000000000002', true, '00000000-0000-0000-5555-FFF000000002', null), -- aaaaaaaaaaaaavkvaaaaaaaaai
('00000000-0000-0000-5555-000000000003', true, '00000000-0000-0000-5555-FFF000000003', null); -- aaaaaaaaaaaaavkvaaaaaaaaam
-INSERT INTO work_edit (ident_id, rev_id, redirect_id, editgroup_id) VALUES
- ('00000000-0000-0000-5555-000000000001', '00000000-0000-0000-5555-FFF000000001', null, '00000000-0000-0000-BBBB-000000000003'),
- ('00000000-0000-0000-5555-000000000002', '00000000-0000-0000-5555-FFF000000002', null, '00000000-0000-0000-BBBB-000000000004'),
- ('00000000-0000-0000-5555-000000000002', '00000000-0000-0000-5555-FFF000000003', null, '00000000-0000-0000-BBBB-000000000005');
+INSERT INTO work_edit (ident_id, rev_id, redirect_id, editgroup_id, prev_rev) VALUES
+ ('00000000-0000-0000-5555-000000000001', '00000000-0000-0000-5555-FFF000000001', null, '00000000-0000-0000-BBBB-000000000003', null),
+ ('00000000-0000-0000-5555-000000000002', '00000000-0000-0000-5555-FFF000000002', null, '00000000-0000-0000-BBBB-000000000004', null),
+ ('00000000-0000-0000-5555-000000000002', '00000000-0000-0000-5555-FFF000000003', null, '00000000-0000-0000-BBBB-000000000005', '00000000-0000-0000-5555-FFF000000002');
INSERT INTO release_rev (id, work_ident_id, container_ident_id, title, release_type, release_status, release_date, doi, isbn13, volume, issue, pages, publisher, language) VALUES
('00000000-0000-0000-4444-FFF000000001', '00000000-0000-0000-5555-000000000001', null, 'example title', null, null, null, null, null, null, null, null, null, null),
@@ -363,25 +416,29 @@ INSERT INTO release_ident (id, is_live, rev_id, redirect_id) VALUES
('00000000-0000-0000-4444-000000000002', true, '00000000-0000-0000-4444-FFF000000002', null), -- aaaaaaaaaaaaarceaaaaaaaaai
('00000000-0000-0000-4444-000000000003', true, '00000000-0000-0000-4444-FFF000000003', null); -- aaaaaaaaaaaaarceaaaaaaaaam
-INSERT INTO release_edit (ident_id, rev_id, redirect_id, editgroup_id) VALUES
- ('00000000-0000-0000-4444-000000000001', '00000000-0000-0000-4444-FFF000000001', null, '00000000-0000-0000-BBBB-000000000003'),
- ('00000000-0000-0000-4444-000000000002', '00000000-0000-0000-4444-FFF000000002', null, '00000000-0000-0000-BBBB-000000000004'),
- ('00000000-0000-0000-4444-000000000003', '00000000-0000-0000-4444-FFF000000003', null, '00000000-0000-0000-BBBB-000000000005');
+INSERT INTO release_edit (ident_id, rev_id, redirect_id, editgroup_id, prev_rev) VALUES
+ ('00000000-0000-0000-4444-000000000001', '00000000-0000-0000-4444-FFF000000001', null, '00000000-0000-0000-BBBB-000000000003', null),
+ ('00000000-0000-0000-4444-000000000002', '00000000-0000-0000-4444-FFF000000002', null, '00000000-0000-0000-BBBB-000000000004', null),
+ ('00000000-0000-0000-4444-000000000003', '00000000-0000-0000-4444-FFF000000003', null, '00000000-0000-0000-BBBB-000000000005', '00000000-0000-0000-4444-FFF000000002');
+
+INSERT INTO release_rev_abstracts (release_rev, abstract_sha1, mimetype, lang) VALUES
+ ('00000000-0000-0000-4444-FFF000000001', '1ba86bf8c2979a62d29b18b537e50b2b093be27e', 'text/plain', 'en'),
+ ('00000000-0000-0000-4444-FFF000000002', '0da908ab584b5e445a06beb172e3fab8cb5169e3', 'application/xml+jats', 'en');
INSERT INTO release_contrib (release_rev, creator_ident_id, raw, role, index) VALUES
('00000000-0000-0000-4444-FFF000000002', null, null, null, null),
('00000000-0000-0000-4444-FFF000000002', '00000000-0000-0000-2222-000000000002', 'some contrib', 'editor', 4),
('00000000-0000-0000-4444-FFF000000003', '00000000-0000-0000-2222-000000000003', 'John P. A. Ioannidis', 'author', 0);
-INSERT INTO release_ref (release_rev, target_release_ident_id, index, raw) VALUES
+INSERT INTO release_ref (release_rev, target_release_ident_id, index, extra_json) VALUES
('00000000-0000-0000-4444-FFF000000002', null, null, null),
- ('00000000-0000-0000-4444-FFF000000002', '00000000-0000-0000-4444-000000000001', 4, 'citation note'),
- ('00000000-0000-0000-4444-FFF000000003', null, 0, 'Ioannidis JP, Haidich AB, Lau J. Any casualties in the clash of randomised and observational evidence? BMJ. 2001;322:879–880'),
- ('00000000-0000-0000-4444-FFF000000003', null, 1, 'Lawlor DA, Davey Smith G, Kundu D, Bruckdorfer KR, Ebrahim S. Those confounded vitamins: What can we learn from the differences between observational versus randomised trial evidence? Lancet. 2004;363:1724–1727.'),
- ('00000000-0000-0000-4444-FFF000000003', null, 2, 'Vandenbroucke JP. When are observational studies as credible as randomised trials? Lancet. 2004;363:1728–1731.'),
- ('00000000-0000-0000-4444-FFF000000003', null, 3, 'Michiels S, Koscielny S, Hill C. Prediction of cancer outcome with microarrays: A multiple random validation strategy. Lancet. 2005;365:488–492.'),
- ('00000000-0000-0000-4444-FFF000000003', null, 4, 'Ioannidis JPA, Ntzani EE, Trikalinos TA, Contopoulos-Ioannidis DG. Replication validity of genetic association studies. Nat Genet. 2001;29:306–309.'),
- ('00000000-0000-0000-4444-FFF000000003', null, 5, 'Colhoun HM, McKeigue PM, Davey Smith G. Problems of reporting genetic associations with complex outcomes. Lancet. 2003;361:865–872.');
+ ('00000000-0000-0000-4444-FFF000000002', '00000000-0000-0000-4444-000000000001', 4, '{"unstructured":"citation note"}'),
+ ('00000000-0000-0000-4444-FFF000000003', null, 0, '{"unstructured": "Ioannidis JP, Haidich AB, Lau J. Any casualties in the clash of randomised and observational evidence? BMJ. 2001;322:879–880"}'),
+ ('00000000-0000-0000-4444-FFF000000003', null, 1, '{"unstructured":"Lawlor DA, Davey Smith G, Kundu D, Bruckdorfer KR, Ebrahim S. Those confounded vitamins: What can we learn from the differences between observational versus randomised trial evidence? Lancet. 2004;363:1724–1727."}'),
+ ('00000000-0000-0000-4444-FFF000000003', null, 2, '{"unstructured":"Vandenbroucke JP. When are observational studies as credible as randomised trials? Lancet. 2004;363:1728–1731."}'),
+ ('00000000-0000-0000-4444-FFF000000003', null, 3, '{"unstructured":"Michiels S, Koscielny S, Hill C. Prediction of cancer outcome with microarrays: A multiple random validation strategy. Lancet. 2005;365:488–492."}'),
+ ('00000000-0000-0000-4444-FFF000000003', null, 4, '{"unstructured":"Ioannidis JPA, Ntzani EE, Trikalinos TA, Contopoulos-Ioannidis DG. Replication validity of genetic association studies. Nat Genet. 2001;29:306–309."}'),
+ ('00000000-0000-0000-4444-FFF000000003', null, 5, '{"unstructured":"Colhoun HM, McKeigue PM, Davey Smith G. Problems of reporting genetic associations with complex outcomes. Lancet. 2003;361:865–872."}');
INSERT INTO file_release (file_rev, target_release_ident_id) VALUES
('00000000-0000-0000-3333-FFF000000002', '00000000-0000-0000-4444-000000000002'),