From 6ece23cce5f90eed034ea34a1c751da64d812a87 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 24 May 2018 17:42:42 -0700 Subject: update codegen and hack-fix tests --- rust/src/api_server.rs | 19 +++++++++---------- rust/src/database_models.rs | 4 ++-- rust/src/database_schema.rs | 4 ++-- 3 files changed, 13 insertions(+), 14 deletions(-) (limited to 'rust/src') diff --git a/rust/src/api_server.rs b/rust/src/api_server.rs index c91af9c9..5069d15d 100644 --- a/rust/src/api_server.rs +++ b/rust/src/api_server.rs @@ -543,8 +543,9 @@ impl Api for Server { Some(param) => param as i64, }; - let edit: FileEditRow = diesel::sql_query( - "WITH rev AS ( INSERT INTO file_rev (size, sha1, url) + let edit: FileEditRow = + diesel::sql_query( + "WITH rev AS ( INSERT INTO file_rev (size, sha1, url) VALUES ($1, $2, $3) RETURNING id ), ident AS ( INSERT INTO file_ident (rev_id) @@ -553,14 +554,12 @@ impl Api for Server { INSERT INTO file_edit (editgroup_id, ident_id, rev_id) VALUES ($4, (SELECT ident.id FROM ident), (SELECT rev.id FROM rev)) RETURNING *", - ).bind::, _>( - body.size.map(|v| v as i32), - ) - .bind::, _>(body.sha1) - .bind::, _>(body.url) - .bind::(editgroup_id) - .get_result(&conn) - .unwrap(); + ).bind::, _>(body.size) + .bind::, _>(body.sha1) + .bind::, _>(body.url) + .bind::(editgroup_id) + .get_result(&conn) + .unwrap(); let edit = &edit; let entity_edit = EntityEdit { diff --git a/rust/src/database_models.rs b/rust/src/database_models.rs index d9305e9f..8e93d69e 100644 --- a/rust/src/database_models.rs +++ b/rust/src/database_models.rs @@ -106,7 +106,7 @@ entity_structs!( pub struct FileRevRow { pub id: i64, //extra_json: Option, - pub size: Option, + pub size: Option, pub sha1: Option, pub url: Option, } @@ -181,7 +181,7 @@ pub struct FileReleaseRow { #[table_name = "editgroup"] pub struct EditgroupRow { pub id: i64, - pub extra_json: Option, + //pub extra_json: Option, pub editor_id: i64, pub description: Option, } diff --git a/rust/src/database_schema.rs b/rust/src/database_schema.rs index 9bcedf3e..a3b9cf2f 100644 --- a/rust/src/database_schema.rs +++ b/rust/src/database_schema.rs @@ -64,7 +64,7 @@ table! { table! { editgroup (id) { id -> Int8, - extra_json -> Nullable, + //extra_json -> Nullable, editor_id -> Int8, description -> Nullable, } @@ -108,7 +108,7 @@ table! { table! { file_rev (id) { id -> Int8, - extra_json -> Nullable, + //extra_json -> Nullable, size -> Nullable, sha1 -> Nullable, url -> Nullable, -- cgit v1.2.3