From 80b57a2334e3e646920700a6293ab346d0a2d650 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Greinhofer?= Date: Mon, 2 Sep 2024 15:07:26 -0500 Subject: [PATCH] Populate pipeline tables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Populates the BNA pipeline tables with the migration. Signed-off-by: Rémy Greinhofer --- entity/src/wrappers/mod.rs | 23 +++++++++++++++---- ...02_004130_brokenspoke_analyzer_pipeline.rs | 17 ++++++++++++++ 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/entity/src/wrappers/mod.rs b/entity/src/wrappers/mod.rs index f66d7ac..449a32e 100644 --- a/entity/src/wrappers/mod.rs +++ b/entity/src/wrappers/mod.rs @@ -23,14 +23,29 @@ impl FromStr for ApprovalStatus { } #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub enum BrokenspokeStep { - SqsMessage, - Setup, +pub enum BNAPipelineStatus { + Pending, + Processing, + Completed, +} + +impl FromStr for BNAPipelineStatus { + type Err = serde_plain::Error; + + fn from_str(s: &str) -> Result { + serde_plain::from_str::(s) + } +} + +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +pub enum BNAPipelineStep { Analysis, Cleanup, + Setup, + Save, } -impl FromStr for BrokenspokeStep { +impl FromStr for BNAPipelineStep { type Err = serde_plain::Error; fn from_str(s: &str) -> Result { diff --git a/migration/src/m20240202_004130_brokenspoke_analyzer_pipeline.rs b/migration/src/m20240202_004130_brokenspoke_analyzer_pipeline.rs index 545b797..e1425e6 100644 --- a/migration/src/m20240202_004130_brokenspoke_analyzer_pipeline.rs +++ b/migration/src/m20240202_004130_brokenspoke_analyzer_pipeline.rs @@ -22,6 +22,14 @@ impl MigrationTrait for Migration { .to_owned(), ) .await?; + let insert_statuses = Query::insert() + .into_table(BNAPipelineStatus::Table) + .columns([BNAPipelineStatus::Status]) + .values_panic(["Completed".into()]) + .values_panic(["Pending".into()]) + .values_panic(["Processing".into()]) + .to_owned(); + manager.exec_stmt(insert_statuses).await?; // Create the Brokenspoke Step lookup table. manager @@ -33,6 +41,15 @@ impl MigrationTrait for Migration { .to_owned(), ) .await?; + let insert_statuses = Query::insert() + .into_table(BNAPipelineStep::Table) + .columns([BNAPipelineStep::Step]) + .values_panic(["Analysis".into()]) + .values_panic(["Cleanup".into()]) + .values_panic(["Save".into()]) + .values_panic(["Setup ".into()]) + .to_owned(); + manager.exec_stmt(insert_statuses).await?; // Create the Fargate Price table. manager