summaryrefslogtreecommitdiffstats
path: root/rust/migrations
diff options
context:
space:
mode:
Diffstat (limited to 'rust/migrations')
-rw-r--r--rust/migrations/2019-01-01-000000_init/down.sql1
-rw-r--r--rust/migrations/2019-01-01-000000_init/up.sql169
2 files changed, 93 insertions, 77 deletions
diff --git a/rust/migrations/2019-01-01-000000_init/down.sql b/rust/migrations/2019-01-01-000000_init/down.sql
index 30e712e3..e238a690 100644
--- a/rust/migrations/2019-01-01-000000_init/down.sql
+++ b/rust/migrations/2019-01-01-000000_init/down.sql
@@ -2,6 +2,7 @@
-- in opposite order as up.sql
DROP TABLE IF EXISTS release_contrib CASCADE;
+DROP TABLE IF EXISTS refs_blob CASCADE;
DROP TABLE IF EXISTS release_ref CASCADE;
DROP TABLE IF EXISTS file_rev_release CASCADE;
DROP TABLE IF EXISTS fileset_rev_release CASCADE;
diff --git a/rust/migrations/2019-01-01-000000_init/up.sql b/rust/migrations/2019-01-01-000000_init/up.sql
index b4c7a684..2bb3f4ec 100644
--- a/rust/migrations/2019-01-01-000000_init/up.sql
+++ b/rust/migrations/2019-01-01-000000_init/up.sql
@@ -1,4 +1,5 @@
--- written for Postgres 9.6 with OSSP extension for UUIDs -- ... but actually runs on Postgres 10 in qa/production
+-- written for Postgres 9.6 with OSSP extension for UUIDs
+-- ... but actually runs on Postgres 11 in qa/production/tests
-- Previously VARCHAR and fixed-size CHAR was used in this schema for specific
-- columns (especially fixed-size external identifiers, and hashes). This was
@@ -47,7 +48,7 @@ CREATE TABLE editgroup (
created TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL,
submitted TIMESTAMP WITH TIME ZONE,
is_accepted BOOLEAN DEFAULT false NOT NULL,
- description TEXT,
+ description TEXT CHECK (octet_length(description) >= 1),
extra_json JSONB
);
@@ -60,7 +61,7 @@ CREATE TABLE editgroup_annotation (
editgroup_id UUID REFERENCES editgroup(id) NOT NULL,
editor_id UUID REFERENCES editor(id) NOT NULL,
created TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL,
- comment_markdown TEXT,
+ comment_markdown TEXT CHECK (octet_length(comment_markdown) >= 1),
extra_json JSONB
);
@@ -79,7 +80,13 @@ CREATE INDEX changelog_editgroup_idx ON changelog(editgroup_id);
CREATE TABLE abstracts (
-- fixed size hash (in hex). TODO: switch to bytes
sha1 TEXT PRIMARY KEY CHECK (octet_length(sha1) = 40),
- content TEXT NOT NULL
+ content TEXT NOT NULL CHECK (octet_length(content) >= 8)
+);
+
+CREATE TABLE refs_blob (
+ -- fixed size hash (in hex). TODO: switch to bytes
+ sha1 TEXT PRIMARY KEY CHECK (octet_length(sha1) = 40),
+ refs_json JSONB NOT NULL
);
-------------------- Creators -----------------------------------------------
@@ -87,9 +94,9 @@ CREATE TABLE creator_rev (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
extra_json JSONB,
- display_name TEXT NOT NULL,
- given_name TEXT,
- surname TEXT,
+ display_name TEXT NOT NULL CHECK (octet_length(display_name) >= 1),
+ given_name TEXT CHECK (octet_length(given_name) >= 1),
+ surname TEXT CHECK (octet_length(surname) >= 1),
-- fixed size identifier
orcid TEXT CHECK(octet_length(orcid) = 19),
-- limited size for data quality
@@ -132,15 +139,13 @@ CREATE TABLE container_rev (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
extra_json JSONB,
- name TEXT NOT NULL,
- publisher TEXT,
+ name TEXT NOT NULL CHECK (octet_length(name) >= 1),
+ container_type TEXT,
+ publisher TEXT CHECK (octet_length(publisher) >= 1),
-- fixed size identifier
issnl TEXT CHECK(octet_length(issnl) = 9),
-- limited size for data quality
- wikidata_qid TEXT CHECK(octet_length(wikidata_qid) <= 12),
- abbrev TEXT,
- -- limited size for data quality
- coden TEXT CHECK(octet_length(coden) <= 6)
+ wikidata_qid TEXT CHECK(octet_length(wikidata_qid) <= 12)
);
CREATE INDEX container_rev_issnl_idx ON container_rev(issnl);
@@ -175,10 +180,10 @@ CREATE TABLE file_rev (
size_bytes BIGINT,
-- fixed size hashes (in hex). TODO: switch to binary type type
- sha1 TEXT CHECK(octet_length(sha1) = 40),
- sha256 TEXT CHECK(octet_length(sha256) = 64),
- md5 TEXT CHECK(octet_length(md5) = 32),
- mimetype TEXT
+ sha1 TEXT CHECK (octet_length(sha1) = 40),
+ sha256 TEXT CHECK (octet_length(sha256) = 64),
+ md5 TEXT CHECK (octet_length(md5) = 32),
+ mimetype TEXT CHECK (octet_length(mimetype) >= 3)
);
CREATE INDEX file_rev_sha1_idx ON file_rev(sha1);
@@ -188,8 +193,8 @@ CREATE INDEX file_rev_sha256_idx ON file_rev(sha256);
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 TODO: default web?
- url TEXT NOT NULL
+ rel TEXT NOT NULL CHECK (octet_length(rel) >= 1), -- TODO: enum? web, webarchive, repo, etc
+ url TEXT NOT NULL CHECK (octet_length(url) >= 1)
);
CREATE INDEX file_rev_url_rev_idx ON file_rev_url(file_rev);
@@ -225,8 +230,8 @@ CREATE TABLE fileset_rev (
CREATE TABLE fileset_rev_url (
id BIGSERIAL PRIMARY KEY,
fileset_rev UUID REFERENCES fileset_rev(id) NOT NULL,
- rel TEXT NOT NULL, -- TODO: enum? web, webarchive, repo, etc TODO: default web?
- url TEXT NOT NULL
+ rel TEXT NOT NULL CHECK (octet_length(rel) >= 1), -- TODO: enum? web, webarchive, repo, etc
+ url TEXT NOT NULL CHECK (octet_length(url) >= 1)
);
CREATE INDEX fileset_rev_url_rev_idx ON fileset_rev_url(fileset_rev);
@@ -234,7 +239,7 @@ CREATE INDEX fileset_rev_url_rev_idx ON fileset_rev_url(fileset_rev);
CREATE TABLE fileset_rev_file (
id BIGSERIAL PRIMARY KEY,
fileset_rev UUID REFERENCES fileset_rev(id) NOT NULL,
- path_name TEXT NOT NULL,
+ path_name TEXT NOT NULL CHECK (octet_length(path_name) >= 1),
size_bytes BIGINT NOT NULL,
md5 TEXT CHECK(octet_length(md5) = 32),
sha1 TEXT CHECK(octet_length(sha1) = 40),
@@ -270,15 +275,15 @@ CREATE TABLE webcapture_rev (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
extra_json JSONB,
- original_url TEXT NOT NULL,
+ original_url TEXT NOT NULL CHECK (octet_length(original_url) >= 1),
timestamp TIMESTAMP WITH TIME ZONE NOT NULL
);
CREATE TABLE webcapture_rev_url (
id BIGSERIAL PRIMARY KEY,
webcapture_rev UUID REFERENCES webcapture_rev(id) NOT NULL,
- rel TEXT NOT NULL, -- TODO: enum? web, webarchive, repo, etc TODO: default web?
- url TEXT NOT NULL
+ rel TEXT NOT NULL CHECK (octet_length(rel) >= 1), -- TODO: enum? web, webarchive, repo, etc
+ url TEXT NOT NULL CHECK (octet_length(url) >= 1)
);
CREATE INDEX webcapture_rev_url_rev_idx ON webcapture_rev_url(webcapture_rev);
@@ -286,10 +291,10 @@ CREATE INDEX webcapture_rev_url_rev_idx ON webcapture_rev_url(webcapture_rev);
CREATE TABLE webcapture_rev_cdx (
id BIGSERIAL PRIMARY KEY,
webcapture_rev UUID REFERENCES webcapture_rev(id) NOT NULL,
- surt TEXT NOT NULL,
- timestamp TEXT NOT NULL, -- TODO: timestamp type?
- url TEXT NOT NULL,
- mimetype TEXT,
+ surt TEXT NOT NULL CHECK (octet_length(surt) >= 1),
+ timestamp TIMESTAMP WITH TIME ZONE NOT NULL,
+ url TEXT NOT NULL CHECK (octet_length(url) >= 1),
+ mimetype TEXT CHECK (octet_length(mimetype) >= 1),
status_code BIGINT,
sha1 TEXT CHECK(octet_length(sha1) = 40) NOT NULL,
sha256 TEXT CHECK(octet_length(sha256) = 64)
@@ -326,23 +331,28 @@ 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,
+ refs_blob_sha1 TEXT REFERENCES refs_blob(sha1),
+ title TEXT NOT NULL CHECK (octet_length(title) >= 1),
+ original_title TEXT CHECK (octet_length(original_title) >= 1),
release_type TEXT, -- TODO: enum
release_status TEXT, -- TODO: enum
release_date DATE,
release_year BIGINT,
- doi TEXT,
+ doi TEXT CHECK (octet_length(doi) >= 7),
-- CHECK for length limit for data quality
- pmid TEXT CHECK(octet_length(pmid) <= 12),
- pmcid TEXT CHECK(octet_length(pmcid) <= 12),
- wikidata_qid TEXT CHECK(octet_length(wikidata_qid) <= 12),
- isbn13 TEXT CHECK(octet_length(isbn13) = 17),
- core_id TEXT CHECK(octet_length(core_id) <= 12),
- 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
+ pmid TEXT CHECK (octet_length(pmid) <= 12),
+ pmcid TEXT CHECK (octet_length(pmcid) <= 12),
+ wikidata_qid TEXT CHECK (octet_length(wikidata_qid) <= 12),
+ isbn13 TEXT CHECK (octet_length(isbn13) = 17),
+ core_id TEXT CHECK (octet_length(core_id) <= 12),
+ arxiv_id TEXT CHECK (octet_length(arxiv_id) <= 12),
+ jstor_id TEXT CHECK (octet_length(jstor_id) <= 12),
+ volume TEXT CHECK (octet_length(volume) >= 1),
+ issue TEXT CHECK (octet_length(issue) >= 1),
+ pages TEXT CHECK (octet_length(pages) >= 1),
+ publisher TEXT CHECK (octet_length(publisher) >= 1), -- for books, NOT if container exists
+ language TEXT CHECK (octet_length(language) >= 1), -- primary language of the work's fulltext; RFC1766/ISO639-1
+ license_slug TEXT CHECK (octet_length(license_slug) >= 1)
-- TODO: oclc_ocn (TEXT or BIGINT)
-- TODO: identifier table?
);
@@ -353,14 +363,16 @@ CREATE INDEX release_rev_pmcid_idx ON release_rev(pmcid);
CREATE INDEX release_rev_wikidata_idx ON release_rev(wikidata_qid);
CREATE INDEX release_rev_isbn13_idx ON release_rev(isbn13);
CREATE INDEX release_rev_core_idx ON release_rev(core_id);
+CREATE INDEX release_rev_arxiv_idx ON release_rev(arxiv_id);
+CREATE INDEX release_rev_jstor_idx ON release_rev(jstor_id);
CREATE INDEX release_rev_work_idx ON release_rev(work_ident_id);
CREATE TABLE release_rev_abstract (
id BIGSERIAL PRIMARY KEY,
release_rev UUID REFERENCES release_rev(id) NOT NULL,
abstract_sha1 TEXT REFERENCES abstracts(sha1) NOT NULL,
- mimetype TEXT,
- lang TEXT
+ mimetype TEXT CHECK (octet_length(mimetype) >= 1),
+ lang TEXT CHECK (octet_length(lang) >= 1)
);
CREATE INDEX release_rev_abstract_rev_idx ON release_rev_abstract(release_rev);
@@ -426,8 +438,9 @@ 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_name TEXT,
+ raw_name TEXT CHECK (octet_length(raw_name) >= 1),
role TEXT, -- TODO: enum?
+ raw_affiliation TEXT CHECK (octet_length(raw_affiliation) >= 1),
index_val INTEGER,
extra_json JSONB
);
@@ -436,20 +449,19 @@ CREATE INDEX release_contrib_rev_idx ON release_contrib(release_rev);
CREATE INDEX release_contrib_creator_idx ON release_contrib(creator_ident_id);
CREATE TABLE release_ref (
- id BIGSERIAL PRIMARY KEY,
release_rev UUID REFERENCES release_rev(id) NOT NULL,
- target_release_ident_id UUID REFERENCES release_ident(id), -- or work?
- index_val INTEGER,
- key TEXT,
- extra_json JSONB, -- title, year, container_title, locator (aka, page), oci_id
- container_name TEXT,
- year INTEGER,
- title TEXT,
- locator TEXT
- -- TODO: oci_id (TEXT)
-);
-
-CREATE INDEX release_ref_rev_idx ON release_ref(release_rev);
+ index_val INTEGER NOT NULL,
+ target_release_ident_id UUID REFERENCES release_ident(id) NOT NULL,
+ -- all other fields are interned in refs_blob as JSONB
+ -- key TEXT,
+ -- extra_json JSONB, -- title, year, container_title, locator (aka, page), oci_id
+ -- container_name TEXT,
+ -- year INTEGER,
+ -- title TEXT,
+ -- locator TEXT
+ PRIMARY KEY(release_rev, index_val)
+);
+
CREATE INDEX release_ref_target_release_idx ON release_ref(target_release_ident_id);
CREATE TABLE file_rev_release (
@@ -516,10 +528,10 @@ 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}'),
- ('00000000-0000-0000-1111-FFF000000003', 'PLOS Medicine', 'Public Library of Science', '1549-1277', 'PLoS med.', null, '{"is_oa": true, "in_doaj": true}');
+INSERT INTO container_rev (id, name, publisher, issnl, extra_json) VALUES
+ ('00000000-0000-0000-1111-FFF000000001', 'MySpace Blog', null, null, null),
+ ('00000000-0000-0000-1111-FFF000000002', 'Journal of Trivial Results', 'bogus publishing group', '1234-5678', '{"is_oa": false, "in_doaj": false}'),
+ ('00000000-0000-0000-1111-FFF000000003', 'PLOS Medicine', 'Public Library of Science', '1549-1277', '{"is_oa": true, "in_doaj": true}');
INSERT INTO container_ident (id, is_live, rev_id, redirect_id) VALUES
('00000000-0000-0000-1111-000000000001', true, '00000000-0000-0000-1111-FFF000000001', null), -- aaaaaaaaaaaaaeiraaaaaaaaae
@@ -598,9 +610,9 @@ INSERT INTO webcapture_rev (id, original_url, timestamp) VALUES
('00000000-0000-0000-7777-FFF000000003', 'https://asheesh.org', '2003-02-17T04:47:21Z');
INSERT INTO webcapture_rev_cdx (webcapture_rev, surt, timestamp, url, mimetype, status_code, sha1, sha256) VALUES
- ('00000000-0000-0000-7777-FFF000000002', 'org,example)/', 19960102123456, 'http://example.org', null, 200, '5886903ba5aeaf7446fe9f77bd03adfc029cedf0', null),
- ('00000000-0000-0000-7777-FFF000000003', 'org,asheesh)/', 20030217044721, 'http://asheesh.org:80/', 'text/html', 200, '5886903ba5aeaf7446fe9f77bd03adfc029cedf0', 'ffc1005680cb620eec4c913437dfabbf311b535cfe16cbaeb2faec1f92afc362'),
- ('00000000-0000-0000-7777-FFF000000003', 'org,asheesh)/robots.txt', 20030217044719, 'http://asheesh.org:80/robots.txt', 'text/html', 404, 'a637f1d27d9bcb237310ed29f19c07e1c8cf0aa5', 'ffc1005680cb620eec4c913437dfabbf311b535cfe16cbaeb2faec1f92afc362');
+ ('00000000-0000-0000-7777-FFF000000002', 'org,example)/', '1996-01-02T12:34:56Z', 'http://example.org', null, 200, '5886903ba5aeaf7446fe9f77bd03adfc029cedf0', null),
+ ('00000000-0000-0000-7777-FFF000000003', 'org,asheesh)/', '2003-02-17T04:47:21Z', 'http://asheesh.org:80/', 'text/html', 200, '5886903ba5aeaf7446fe9f77bd03adfc029cedf0', 'ffc1005680cb620eec4c913437dfabbf311b535cfe16cbaeb2faec1f92afc362'),
+ ('00000000-0000-0000-7777-FFF000000003', 'org,asheesh)/robots.txt', '2003-02-17T04:47:19Z', 'http://asheesh.org:80/robots.txt', 'text/html', 404, 'a637f1d27d9bcb237310ed29f19c07e1c8cf0aa5', 'ffc1005680cb620eec4c913437dfabbf311b535cfe16cbaeb2faec1f92afc362');
INSERT INTO webcapture_rev_url (webcapture_rev, rel, url) VALUES
('00000000-0000-0000-7777-FFF000000002', 'wayback', 'http://web.archive.org/201801010001/http://example.org'),
@@ -632,10 +644,14 @@ INSERT INTO work_edit (ident_id, rev_id, redirect_id, editgroup_id, prev_rev) VA
('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, release_year, doi, wikidata_qid, pmid, pmcid, isbn13, core_id, 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, null, null, null, null, null),
- ('00000000-0000-0000-4444-FFF000000002', '00000000-0000-0000-5555-000000000002', '00000000-0000-0000-1111-000000000001', 'bigger example', 'article-journal', null, '2018-01-01', 2018, '10.123/abc', 'Q55555', '54321', 'PMC555','978-3-16-148410-0', '42022773', '12', 'IV', '5-9', 'bogus publishing group', 'cn'),
- ('00000000-0000-0000-4444-FFF000000003', '00000000-0000-0000-5555-000000000003', '00000000-0000-0000-1111-000000000003', 'Why Most Published Research Findings Are False', 'article-journal', 'published', '2005-08-30', 2005, '10.1371/journal.pmed.0020124', null, null, null, null, null, '2', '8', 'e124', 'Public Library of Science', 'en');
+INSERT INTO refs_blob (sha1, refs_json) VALUES
+ ('22222222c2979a62d29b18b537e50b2b093be27e', '[{}, {}, {}, {}, {"extra": {"unstructured":"citation note"}}]'),
+ ('33333333c2979a62d29b18b537e50b2b093be27e', '[{"extra": {"unstructured": "Ioannidis JP, Haidich AB, Lau J. Any casualties in the clash of randomised and observational evidence? BMJ. 2001;322:879–880"}}, {"extra": {"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."}}, {"extra": {"unstructured":"Vandenbroucke JP. When are observational studies as credible as randomised trials? Lancet. 2004;363:1728–1731."}}, {"extra": {"unstructured":"Michiels S, Koscielny S, Hill C. Prediction of cancer outcome with microarrays: A multiple random validation strategy. Lancet. 2005;365:488–492."}}, {"extra": {"unstructured":"Ioannidis JPA, Ntzani EE, Trikalinos TA, Contopoulos-Ioannidis DG. Replication validity of genetic association studies. Nat Genet. 2001;29:306–309."}}, {"extra": {"unstructured":"Colhoun HM, McKeigue PM, Davey Smith G. Problems of reporting genetic associations with complex outcomes. Lancet. 2003;361:865–872."}}]');
+
+INSERT INTO release_rev (id, work_ident_id, container_ident_id, title, release_type, release_status, release_date, release_year, doi, wikidata_qid, pmid, pmcid, isbn13, core_id, volume, issue, pages, publisher, language, refs_blob_sha1) VALUES
+ ('00000000-0000-0000-4444-FFF000000001', '00000000-0000-0000-5555-000000000001', null, 'example title', null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null),
+ ('00000000-0000-0000-4444-FFF000000002', '00000000-0000-0000-5555-000000000002', '00000000-0000-0000-1111-000000000001', 'bigger example', 'article-journal', null, '2018-01-01', 2018, '10.123/abc', 'Q55555', '54321', 'PMC555','978-3-16-148410-0', '42022773', '12', 'IV', '5-9', 'bogus publishing group', 'cn', '22222222c2979a62d29b18b537e50b2b093be27e'),
+ ('00000000-0000-0000-4444-FFF000000003', '00000000-0000-0000-5555-000000000003', '00000000-0000-0000-1111-000000000003', 'Why Most Published Research Findings Are False', 'article-journal', 'published', '2005-08-30', 2005, '10.1371/journal.pmed.0020124', null, null, null, null, null, '2', '8', 'e124', 'Public Library of Science', 'en', '33333333c2979a62d29b18b537e50b2b093be27e');
INSERT INTO release_ident (id, is_live, rev_id, redirect_id) VALUES
('00000000-0000-0000-4444-000000000001', true, '00000000-0000-0000-4444-FFF000000001', null), -- aaaaaaaaaaaaarceaaaaaaaaae
@@ -656,15 +672,14 @@ INSERT INTO release_contrib (release_rev, creator_ident_id, raw_name, role, inde
('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_val, extra_json) VALUES
- ('00000000-0000-0000-4444-FFF000000002', null, null, null),
- ('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 release_ref (release_rev, index_val, target_release_ident_id) VALUES
+ ('00000000-0000-0000-4444-FFF000000002', 4, '00000000-0000-0000-4444-000000000001'), -- '{"unstructured":"citation note"}'),
+ ('00000000-0000-0000-4444-FFF000000003', 0, '00000000-0000-0000-4444-000000000001'), --'{"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', 1, '00000000-0000-0000-4444-000000000001'), --'{"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', 2, '00000000-0000-0000-4444-000000000001'), --'{"unstructured":"Vandenbroucke JP. When are observational studies as credible as randomised trials? Lancet. 2004;363:1728–1731."}'),
+ ('00000000-0000-0000-4444-FFF000000003', 3, '00000000-0000-0000-4444-000000000001'), --'{"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', 4, '00000000-0000-0000-4444-000000000001'), --'{"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', 5, '00000000-0000-0000-4444-000000000001'); --'{"unstructured":"Colhoun HM, McKeigue PM, Davey Smith G. Problems of reporting genetic associations with complex outcomes. Lancet. 2003;361:865–872."}');
INSERT INTO file_rev_release (file_rev, target_release_ident_id) VALUES
('00000000-0000-0000-3333-FFF000000002', '00000000-0000-0000-4444-000000000002'),