From 39921a6fdf47256b9c2fac67b876795fd0426464 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Tue, 14 Aug 2018 17:13:57 -0700 Subject: trivial implementation of core_id field on releases --- rust/src/api_server.rs | 8 +++++--- rust/src/database_models.rs | 1 + rust/src/database_schema.rs | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) (limited to 'rust/src') diff --git a/rust/src/api_server.rs b/rust/src/api_server.rs index e24b7e39..f7866b68 100644 --- a/rust/src/api_server.rs +++ b/rust/src/api_server.rs @@ -255,6 +255,7 @@ fn release_row2entity( pmid: rev.pmid, pmcid: rev.pmcid, isbn13: rev.isbn13, + core_id: rev.core_id, wikidata_qid: rev.wikidata_qid, volume: rev.volume, issue: rev.issue, @@ -684,14 +685,14 @@ impl Server { }; let edit: ReleaseEditRow = diesel::sql_query( - "WITH rev AS ( INSERT INTO release_rev (title, release_type, release_status, release_date, doi, pmid, pmcid, wikidata_qid, isbn13, volume, issue, pages, work_ident_id, container_ident_id, publisher, language, extra_json) - VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17) + "WITH rev AS ( INSERT INTO release_rev (title, release_type, release_status, release_date, doi, pmid, pmcid, wikidata_qid, isbn13, core_id, volume, issue, pages, work_ident_id, container_ident_id, publisher, language, extra_json) + VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18) RETURNING id ), ident AS ( INSERT INTO release_ident (rev_id) VALUES ((SELECT rev.id FROM rev)) RETURNING id ) INSERT INTO release_edit (editgroup_id, ident_id, rev_id) VALUES - ($18, (SELECT ident.id FROM ident), (SELECT rev.id FROM rev)) + ($19, (SELECT ident.id FROM ident), (SELECT rev.id FROM rev)) RETURNING *", ).bind::(entity.title) .bind::, _>(entity.release_type) @@ -703,6 +704,7 @@ impl Server { .bind::, _>(entity.pmcid) .bind::, _>(entity.wikidata_qid) .bind::, _>(entity.isbn13) + .bind::, _>(entity.core_id) .bind::, _>(entity.volume) .bind::, _>(entity.issue) .bind::, _>(entity.pages) diff --git a/rust/src/database_models.rs b/rust/src/database_models.rs index 50176f5f..258bcab7 100644 --- a/rust/src/database_models.rs +++ b/rust/src/database_models.rs @@ -177,6 +177,7 @@ pub struct ReleaseRevRow { pub pmcid: Option, pub wikidata_qid: Option, pub isbn13: Option, + pub core_id: Option, pub volume: Option, pub issue: Option, pub pages: Option, diff --git a/rust/src/database_schema.rs b/rust/src/database_schema.rs index f935302a..3a8fe901 100644 --- a/rust/src/database_schema.rs +++ b/rust/src/database_schema.rs @@ -216,6 +216,7 @@ table! { pmcid -> Nullable, wikidata_qid -> Nullable, isbn13 -> Nullable, + core_id -> Nullable, volume -> Nullable, issue -> Nullable, pages -> Nullable, -- cgit v1.2.3