Skip to content

Commit

Permalink
Fix the BNA Pipeline entity (#140)
Browse files Browse the repository at this point in the history
Fixes the fargate price foreign key in the BNA Pipeline table.

Signed-off-by: Rémy Greinhofer <[email protected]>
  • Loading branch information
rgreinho authored Sep 1, 2024
1 parent ddceac5 commit 5c75b7f
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions docs/database.dbml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Table "bna_pipeline" {
"state_machine_id" uuid [pk, not null]
"step" "character varying"
"sqs_message" json
"fargate_price" integer
"fargate_price_id" integer
"fargate_task_arn" "character varying"
"s3_bucket" "character varying"
"status" "character varying" [not null, default: `'Pending'::charactervarying`]
Expand Down Expand Up @@ -185,7 +185,7 @@ Table "us_state" {
}
}

Ref "bna_pipeline_fargate_price_fkey":"fargate_price"."id" < "bna_pipeline"."fargate_price"
Ref "bna_pipeline_fargate_price_id_fkey":"fargate_price"."id" < "bna_pipeline"."fargate_price_id"

Ref "bna_pipeline_status_fkey":"bna_pipeline_status"."status" < "bna_pipeline"."status"

Expand Down
6 changes: 3 additions & 3 deletions docs/database.sql
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ CREATE TABLE public.bna_pipeline (
state_machine_id uuid NOT NULL,
step character varying,
sqs_message json,
fargate_price integer,
fargate_price_id integer,
fargate_task_arn character varying,
s3_bucket character varying,
status character varying DEFAULT 'Pending'::character varying NOT NULL,
Expand Down Expand Up @@ -715,11 +715,11 @@ CREATE INDEX us_state_fips_code_idx ON public.us_state USING btree (fips_code);


--
-- Name: bna_pipeline bna_pipeline_fargate_price_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
-- Name: bna_pipeline bna_pipeline_fargate_price_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.bna_pipeline
ADD CONSTRAINT bna_pipeline_fargate_price_fkey FOREIGN KEY (fargate_price) REFERENCES public.fargate_price(id);
ADD CONSTRAINT bna_pipeline_fargate_price_id_fkey FOREIGN KEY (fargate_price_id) REFERENCES public.fargate_price(id);


--
Expand Down
2 changes: 1 addition & 1 deletion docs/database.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions entity/src/entities/bna_pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub struct Model {
pub state_machine_id: Uuid,
pub step: Option<String>,
pub sqs_message: Option<Json>,
pub fargate_price: Option<i32>,
pub fargate_price_id: Option<i32>,
pub fargate_task_arn: Option<String>,
pub s3_bucket: Option<String>,
pub status: String,
Expand Down Expand Up @@ -41,7 +41,7 @@ pub enum Relation {
BnaPipelineStep,
#[sea_orm(
belongs_to = "super::fargate_price::Entity",
from = "Column::FargatePrice",
from = "Column::FargatePriceId",
to = "super::fargate_price::Column::Id",
on_update = "NoAction",
on_delete = "NoAction"
Expand Down
12 changes: 6 additions & 6 deletions entity/src/wrappers/bna_pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use serde::{Deserialize, Serialize};
pub struct BNAPipelinePost {
pub cost: Option<Decimal>,
pub end_time: Option<TimeDateTimeWithTimeZone>,
pub fargate_price: Option<i32>,
pub fargate_price_id: Option<i32>,
pub fargate_task_arn: Option<String>,
pub result_posted: Option<bool>,
pub s3_bucket: Option<String>,
Expand All @@ -26,16 +26,16 @@ impl IntoActiveModel<bna_pipeline::ActiveModel> for BNAPipelinePost {
bna_pipeline::ActiveModel {
cost: ActiveValue::Set(self.cost),
end_time: ActiveValue::Set(self.end_time),
fargate_price_id: ActiveValue::Set(self.fargate_price_id),
fargate_task_arn: ActiveValue::Set(self.fargate_task_arn),
results_posted: ActiveValue::Set(self.result_posted),
s3_bucket: ActiveValue::Set(self.s3_bucket),
sqs_message: ActiveValue::Set(self.sqs_message),
start_time: ActiveValue::Set(self.start_time),
state_machine_id: ActiveValue::Set(self.state_machine_id),
status: ActiveValue::Set(self.status),
step: ActiveValue::Set(self.step),
torn_down: ActiveValue::Set(self.torn_down),
fargate_price: ActiveValue::Set(self.fargate_price),
status: ActiveValue::Set(self.status),
}
}
}
Expand All @@ -44,7 +44,7 @@ impl IntoActiveModel<bna_pipeline::ActiveModel> for BNAPipelinePost {
pub struct BNAPipelinePatch {
pub cost: Option<Option<Decimal>>,
pub end_time: Option<Option<TimeDateTimeWithTimeZone>>,
pub fargate_price: Option<Option<i32>>,
pub fargate_price_id: Option<Option<i32>>,
pub fargate_task_arn: Option<Option<String>>,
pub neon_branch_id: Option<Option<String>>,
pub result_posted: Option<Option<bool>>,
Expand Down Expand Up @@ -77,8 +77,8 @@ impl IntoActiveModel<bna_pipeline::ActiveModel> for BNAPipelinePatch {
results_posted: self
.result_posted
.map_or(ActiveValue::NotSet, ActiveValue::Set),
fargate_price: self
.fargate_price
fargate_price_id: self
.fargate_price_id
.map_or(ActiveValue::NotSet, ActiveValue::Set),
status: self.status.map_or(ActiveValue::NotSet, ActiveValue::Set),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl MigrationTrait for Migration {
.col(uuid(BNAPipeline::StateMachineId).primary_key())
.col(string_null(BNAPipeline::Step))
.col(json_null(BNAPipeline::SqsMessage))
.col(integer_null(BNAPipeline::FargatePrice))
.col(integer_null(BNAPipeline::FargatePriceId))
.col(string_null(BNAPipeline::FargateTaskARN))
.col(string_null(BNAPipeline::S3Bucket))
.col(string(BNAPipeline::Status).default("Pending".to_string()))
Expand All @@ -80,7 +80,7 @@ impl MigrationTrait for Migration {
)
.foreign_key(
ForeignKey::create()
.from(BNAPipeline::Table, BNAPipeline::FargatePrice)
.from(BNAPipeline::Table, BNAPipeline::FargatePriceId)
.to(FargatePrice::Table, FargatePrice::Id),
)
.to_owned(),
Expand Down Expand Up @@ -112,7 +112,7 @@ enum BNAPipeline {
Table,
Cost,
EndTime,
FargatePrice,
FargatePriceId,
FargateTaskARN,
ResultsPosted,
S3Bucket,
Expand Down

0 comments on commit 5c75b7f

Please sign in to comment.