From 2a1e017c063c462da3702e0227cb075643013988 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Fri, 5 Feb 2021 15:28:42 +0100 Subject: Remove "tree" from submit This removes the "tree" column from the "submits" table. This is because we do not store the build-tree in the database anymore. We don't actually need this feature and we can always re-build the tree from an old commit in the repository. Thus, this is not required anymore. Also, it is less easy to do as soon as the internal implementation changes from a "tree" structure to a "DAG" structure. Signed-off-by: Matthias Beyer --- src/commands/build.rs | 1 - src/db/models/submit.rs | 9 --------- src/schema.rs | 1 - 3 files changed, 11 deletions(-) (limited to 'src') diff --git a/src/commands/build.rs b/src/commands/build.rs index 3f168fa..b1d3e58 100644 --- a/src/commands/build.rs +++ b/src/commands/build.rs @@ -291,7 +291,6 @@ pub async fn build( trace!("Creating Submit in database"); let submit = Submit::create( &database_connection, - &tree, &now, &submit_id, &db_image, diff --git a/src/db/models/submit.rs b/src/db/models/submit.rs index a33bf96..7792adf 100644 --- a/src/db/models/submit.rs +++ b/src/db/models/submit.rs @@ -8,7 +8,6 @@ // SPDX-License-Identifier: EPL-2.0 // -use anyhow::anyhow; use anyhow::Context; use anyhow::Error; use anyhow::Result; @@ -33,7 +32,6 @@ pub struct Submit { pub requested_image_id: i32, pub requested_package_id: i32, pub repo_hash_id: i32, - pub tree: serde_json::Value, } #[derive(Insertable)] @@ -44,30 +42,23 @@ struct NewSubmit<'a> { pub requested_image_id: i32, pub requested_package_id: i32, pub repo_hash_id: i32, - pub tree: serde_json::Value, } impl Submit { pub fn create( database_connection: &PgConnection, - t: &crate::package::Tree, submit_datetime: &NaiveDateTime, submit_id: &::uuid::Uuid, requested_image: &Image, requested_package: &Package, repo_hash: &GitHash, ) -> Result { - let tree_json = serde_json::to_value(t) - .context("Converting tree to JSON string") - .with_context(|| anyhow!("Tree = {:#?}", t))?; - let new_submit = NewSubmit { uuid: submit_id, submit_time: submit_datetime, requested_image_id: requested_image.id, requested_package_id: requested_package.id, repo_hash_id: repo_hash.id, - tree: tree_json, }; diesel::insert_into(submits::table) diff --git a/src/schema.rs b/src/schema.rs index 676b0f7..d888dcd 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -105,7 +105,6 @@ table! { requested_image_id -> Int4, requested_package_id -> Int4, repo_hash_id -> Int4, - tree -> Jsonb, } } -- cgit v1.2.3