Skip to content

Commit d66b2d4

Browse files
Final mysql bugs
1 parent 35d9e4e commit d66b2d4

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

database_functions/migration_definitions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2765,7 +2765,7 @@ def migration_032_create_user_default_playlists(conn, db_type: str):
27652765
'description': 'Perfect-length episodes (15-45 minutes) for your daily commute',
27662766
'min_duration': 900, # 15 minutes
27672767
'max_duration': 2700, # 45 minutes
2768-
'sort_order': 'random',
2768+
'sort_order': 'date_desc',
27692769
'icon_name': 'ph-car-simple',
27702770
'max_episodes': 1000
27712771
}

rust-api/src/database.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1809,9 +1809,9 @@ impl DatabasePool {
18091809
.bind(podcast_id)
18101810
.fetch_optional(pool)
18111811
.await?;
1812-
1812+
18131813
if let Some(row) = row {
1814-
if let Some(merged_json) = row.try_get::<Option<String>, _>("mergedpodcastids")? {
1814+
if let Some(merged_json) = row.try_get::<Option<String>, _>("MergedPodcastIDs")? {
18151815
let merged_ids: Vec<i32> = serde_json::from_str(&merged_json).unwrap_or_default();
18161816
Ok(merged_ids)
18171817
} else {
@@ -18732,7 +18732,7 @@ impl DatabasePool {
1873218732
let row = playlist_row.unwrap();
1873318733
let playlist_name: String = row.try_get("Name")?;
1873418734
let playlist_description: String = row.try_get("Description").unwrap_or_default();
18735-
let episode_count: i64 = row.try_get("EpisodeCount")?;
18735+
let episode_count: i64 = row.try_get("episode_count")?;
1873618736
let icon_name: String = row.try_get("IconName").unwrap_or_default();
1873718737
let is_system_playlist: bool = row.try_get::<i8, _>("IsSystemPlaylist")? != 0;
1873818738

@@ -23843,7 +23843,7 @@ impl DatabasePool {
2384323843
UserID, Name, Description, IsSystemPlaylist, MinDuration, MaxDuration, SortOrder,
2384423844
IncludeUnplayed, IncludePartiallyPlayed, IncludePlayed, TimeFilterHours,
2384523845
GroupByPodcast, MaxEpisodes, PlayProgressMin, PlayProgressMax, PodcastIDs,
23846-
IconName, episode_count
23846+
IconName, EpisodeCount
2384723847
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
2384823848
")
2384923849
.bind(user_id).bind(name).bind(description).bind(false)
@@ -23925,7 +23925,7 @@ impl DatabasePool {
2392523925
UserID, Name, Description, IsSystemPlaylist, MinDuration, MaxDuration, SortOrder,
2392623926
IncludeUnplayed, IncludePartiallyPlayed, IncludePlayed, TimeFilterHours,
2392723927
GroupByPodcast, MaxEpisodes, PlayProgressMin, PlayProgressMax, PodcastIDs,
23928-
IconName, episode_count
23928+
IconName, EpisodeCount
2392923929
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
2393023930
")
2393123931
.bind(user_id).bind(name).bind(description).bind(false)
@@ -24013,7 +24013,7 @@ impl DatabasePool {
2401324013
Ok(count) => {
2401424014
// Update the episode_count in the playlist
2401524015
match sqlx::query(
24016-
r#"UPDATE Playlists SET episode_count = ? WHERE PlaylistID = ?"#
24016+
r#"UPDATE Playlists SET EpisodeCount = ? WHERE PlaylistID = ?"#
2401724017
).bind(count).bind(playlist_id).execute(pool).await {
2401824018
Ok(_) => {
2401924019
debug!("Updated MySQL playlist '{}' (ID: {}) count to {}", name, playlist_id, count);
@@ -24615,10 +24615,10 @@ impl DatabasePool {
2461524615
debug!("User {} timezone: {} -> {}", user_id, raw_timezone, user_timezone);
2461624616

2461724617
let playlist_row = sqlx::query(
24618-
r#"SELECT UserID, Name, Description, MinDuration, MaxDuration, SortOrder,
24618+
r#"SELECT UserID, Name, Description, MinDuration, MaxDuration, SortOrder,
2461924619
IncludeUnplayed, IncludePartiallyPlayed, IncludePlayed, TimeFilterHours,
2462024620
GroupByPodcast, MaxEpisodes, PlayProgressMin, PlayProgressMax, PodcastIDs,
24621-
IsSystemPlaylist, Created, IconName, episode_count
24621+
IsSystemPlaylist, Created, IconName, EpisodeCount
2462224622
FROM Playlists WHERE PlaylistID = ?"#
2462324623
).bind(playlist_id).fetch_optional(pool).await?;
2462424624

0 commit comments

Comments
 (0)