Skip to content

Commit

Permalink
fix(database): migrations with inconsistencies
Browse files Browse the repository at this point in the history
  • Loading branch information
IgnisDa committed Jul 27, 2024
1 parent 9dca27b commit f461089
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub static ENTITY_ID_SQL: &str = indoc! { r#"
"exercise_id",
"workout_id"
)
) STORED;
) STORED
"# };
pub static ENTITY_LOT_SQL: &str = indoc! { r#"
GENERATED ALWAYS AS (
Expand All @@ -48,7 +48,7 @@ pub static ENTITY_LOT_SQL: &str = indoc! { r#"
WHEN "exercise_id" IS NOT NULL THEN 'exercise'
WHEN "workout_id" IS NOT NULL THEN 'workout'
END
) STORED;
) STORED
"# };

#[derive(Iden)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ impl MigrationTrait for Migration {
db.execute_unprepared(
r#"
ALTER TABLE collection_to_entity
ADD COLUMN entity_id text GENERATED ALWAYS AS (
ADD COLUMN IF NOT EXISTS entity_id text GENERATED ALWAYS AS (
COALESCE(metadata_id,
person_id,
metadata_group_id,
Expand All @@ -26,7 +26,7 @@ ADD COLUMN entity_id text GENERATED ALWAYS AS (
db.execute_unprepared(
r#"
ALTER TABLE collection_to_entity
ADD COLUMN entity_lot text GENERATED ALWAYS AS (
ADD COLUMN IF NOT EXISTS entity_lot text GENERATED ALWAYS AS (
CASE
WHEN metadata_id IS NOT NULL THEN 'metadata'
WHEN person_id IS NOT NULL THEN 'person'
Expand Down

0 comments on commit f461089

Please sign in to comment.