aboutsummaryrefslogtreecommitdiffstats
path: root/rust
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-09-17 13:56:36 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-09-17 13:56:36 -0700
commit8baa2d8808797e423829fb040d70206d24b6156e (patch)
tree62adfdd84118b0869fd9cc5a684d38d037a9f529 /rust
parent5feeb70f930e733587ad7fa33d361cf24602abca (diff)
downloadfatcat-8baa2d8808797e423829fb040d70206d24b6156e.tar.gz
fatcat-8baa2d8808797e423829fb040d70206d24b6156e.zip
fix CHECK clauses
Diffstat (limited to 'rust')
-rw-r--r--rust/TODO1
-rw-r--r--rust/migrations/2018-05-12-001226_init/up.sql14
-rw-r--r--rust/src/database_schema.rs30
3 files changed, 23 insertions, 22 deletions
diff --git a/rust/TODO b/rust/TODO
index d424c76c..c8a1a1bd 100644
--- a/rust/TODO
+++ b/rust/TODO
@@ -5,6 +5,7 @@ correctness
- enforce "no editing if editgroup accepted" behavior
- changelog sequence without gaps
- batch insert editgroup behavior; always a new editgroup?
+- redirect rev_id needs to be updated when primary changes
edit lifecycle
- editgroup: state to track review status?
diff --git a/rust/migrations/2018-05-12-001226_init/up.sql b/rust/migrations/2018-05-12-001226_init/up.sql
index a6384f4e..d94e9b71 100644
--- a/rust/migrations/2018-05-12-001226_init/up.sql
+++ b/rust/migrations/2018-05-12-001226_init/up.sql
@@ -47,7 +47,7 @@ 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),
+ sha1 TEXT PRIMARY KEY CHECK (octet_length(sha1) = 40),
content TEXT NOT NULL
);
@@ -60,7 +60,7 @@ CREATE TABLE creator_rev (
given_name TEXT,
surname TEXT,
-- fixed size identifier
- orcid TEXT CHECK(octet_length(orcid) == 19),
+ orcid TEXT CHECK(octet_length(orcid) = 19),
-- limited size for data quality
wikidata_qid TEXT CHECK(octet_length(wikidata_qid) <= 12)
@@ -103,7 +103,7 @@ CREATE TABLE container_rev (
name TEXT NOT NULL,
publisher TEXT,
-- fixed size identifier
- issnl TEXT CHECK(octet_length(issnl) == 9),
+ issnl TEXT CHECK(octet_length(issnl) = 9),
-- limited size for data quality
wikidata_qid TEXT CHECK(octet_length(wikidata_qid) <= 12),
abbrev TEXT,
@@ -142,9 +142,9 @@ CREATE TABLE file_rev (
size 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),
+ sha1 TEXT CHECK(octet_length(sha1) = 40),
+ sha256 TEXT CHECK(octet_length(sha256) = 64),
+ md5 TEXT CHECK(octet_length(md5) = 32),
mimetype TEXT
);
@@ -198,7 +198,7 @@ CREATE TABLE release_rev (
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) == 13),
+ isbn13 TEXT CHECK(octet_length(isbn13) = 13),
core_id TEXT CHECK(octet_length(core_id) <= 12),
volume TEXT,
issue TEXT,
diff --git a/rust/src/database_schema.rs b/rust/src/database_schema.rs
index bc3f6c3a..d7bba7dc 100644
--- a/rust/src/database_schema.rs
+++ b/rust/src/database_schema.rs
@@ -1,6 +1,6 @@
table! {
abstracts (sha1) {
- sha1 -> Bpchar,
+ sha1 -> Varchar,
content -> Text,
}
}
@@ -41,10 +41,10 @@ table! {
extra_json -> Nullable<Jsonb>,
name -> Text,
publisher -> Nullable<Text>,
- issnl -> Nullable<Bpchar>,
- wikidata_qid -> Nullable<Text>,
+ issnl -> Nullable<Varchar>,
+ wikidata_qid -> Nullable<Varchar>,
abbrev -> Nullable<Text>,
- coden -> Nullable<Text>,
+ coden -> Nullable<Varchar>,
}
}
@@ -77,8 +77,8 @@ table! {
display_name -> Text,
given_name -> Nullable<Text>,
surname -> Nullable<Text>,
- orcid -> Nullable<Bpchar>,
- wikidata_qid -> Nullable<Text>,
+ orcid -> Nullable<Varchar>,
+ wikidata_qid -> Nullable<Varchar>,
}
}
@@ -136,9 +136,9 @@ table! {
id -> Uuid,
extra_json -> Nullable<Jsonb>,
size -> Nullable<Int8>,
- sha1 -> Nullable<Bpchar>,
- sha256 -> Nullable<Bpchar>,
- md5 -> Nullable<Bpchar>,
+ sha1 -> Nullable<Varchar>,
+ sha256 -> Nullable<Varchar>,
+ md5 -> Nullable<Varchar>,
mimetype -> Nullable<Text>,
}
}
@@ -212,11 +212,11 @@ table! {
release_status -> Nullable<Text>,
release_date -> Nullable<Date>,
doi -> Nullable<Text>,
- pmid -> Nullable<Text>,
- pmcid -> Nullable<Text>,
- wikidata_qid -> Nullable<Text>,
- isbn13 -> Nullable<Text>,
- core_id -> Nullable<Text>,
+ pmid -> Nullable<Varchar>,
+ pmcid -> Nullable<Varchar>,
+ wikidata_qid -> Nullable<Varchar>,
+ isbn13 -> Nullable<Varchar>,
+ core_id -> Nullable<Varchar>,
volume -> Nullable<Text>,
issue -> Nullable<Text>,
pages -> Nullable<Text>,
@@ -229,7 +229,7 @@ table! {
release_rev_abstract (id) {
id -> Int8,
release_rev -> Uuid,
- abstract_sha1 -> Bpchar,
+ abstract_sha1 -> Varchar,
mimetype -> Nullable<Text>,
lang -> Nullable<Text>,
}