Skip to content

Commit

Permalink
Populate pipeline tables
Browse files Browse the repository at this point in the history
Populates the BNA pipeline tables with the migration.

Signed-off-by: Rémy Greinhofer <[email protected]>
  • Loading branch information
rgreinho committed Sep 2, 2024
1 parent 5c75b7f commit 80b57a2
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 4 deletions.
23 changes: 19 additions & 4 deletions entity/src/wrappers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Self, Self::Err> {
serde_plain::from_str::<Self>(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<Self, Self::Err> {
Expand Down
17 changes: 17 additions & 0 deletions migration/src/m20240202_004130_brokenspoke_analyzer_pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 80b57a2

Please sign in to comment.