Skip to content

Commit

Permalink
fix(migrations): migrate over old workout template data
Browse files Browse the repository at this point in the history
  • Loading branch information
IgnisDa committed Jan 2, 2025
1 parent 15c3b29 commit e052423
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
16 changes: 11 additions & 5 deletions crates/migrations/src/m20241126_changes_for_issue_1113.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,14 @@ UPDATE exercise SET identifier = id;
ALTER TABLE exercise RENAME COLUMN identifier TO name;
DROP INDEX "exercise__identifier__index";
CREATE INDEX "{}" ON "exercise" ("name");
UPDATE workout
"#,
EXERCISE_NAME_INDEX
))
.await?;
for table in ["workout", "workout_template"] {
db.execute_unprepared(&format!(
r#"
UPDATE "{table}"
SET information =
JSONB_SET(
information,
Expand Down Expand Up @@ -59,9 +65,9 @@ SET information =
)
);
"#,
EXERCISE_NAME_INDEX
))
.await?;
))
.await?;
}
}
db.execute_unprepared(
r#"
Expand Down
1 change: 1 addition & 0 deletions crates/models/fitness/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,7 @@ pub struct WorkoutInformation {
}

/// The summary about an exercise done in a workout.
#[skip_serializing_none]
#[derive(
Eq,
Clone,
Expand Down

0 comments on commit e052423

Please sign in to comment.