Skip to content

Commit

Permalink
[1.132.*] Pre-release merge (#467)
Browse files Browse the repository at this point in the history
  • Loading branch information
tramline-github[bot] authored Apr 18, 2024
2 parents 6295df3 + 1896a96 commit 71c5ac3
Showing 1 changed file with 42 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,54 +47,75 @@ object SQLCodeMigrations {
val newFeedId = nameBasedUuidOf(oldFeedId).toString()
driver.execute(
identifier = null,
sql = "UPDATE feed SET id = '$newFeedId' WHERE id = '$oldFeedId'",
parameters = 0,
binders = null
sql = "UPDATE feed SET id = ? WHERE id = ?",
parameters = 2,
binders = {
bindString(0, newFeedId)
bindString(1, oldFeedId)
}
)

driver.execute(
identifier = null,
sql = "UPDATE feed_search SET id = '$newFeedId' WHERE id = '$oldFeedId'",
parameters = 0,
binders = null
sql = "UPDATE feed_search SET id = ? WHERE id = ?",
parameters = 2,
binders = {
bindString(0, newFeedId)
bindString(1, oldFeedId)
}
)

driver.execute(
identifier = null,
sql = "UPDATE bookmark SET sourceId = '$newFeedId' WHERE sourceId = '$oldFeedId'",
parameters = 0,
binders = null
sql = "UPDATE bookmark SET sourceId = ? WHERE sourceId = ?",
parameters = 2,
binders = {
bindString(0, newFeedId)
bindString(1, oldFeedId)
}
)

driver.execute(
identifier = null,
sql = "UPDATE post SET sourceId = '$newFeedId' WHERE sourceId = '$oldFeedId'",
parameters = 0,
binders = null
sql = "UPDATE post SET sourceId = ? WHERE sourceId = ?",
parameters = 2,
binders = {
bindString(0, newFeedId)
bindString(1, oldFeedId)
}
)
}

private fun migratePostLinkIdsToUuid(driver: SqlDriver, oldPostId: String) {
val newPostId = nameBasedUuidOf(oldPostId).toString()
driver.execute(
identifier = null,
sql = "UPDATE bookmark SET id = '$newPostId' WHERE id = '$oldPostId'",
parameters = 0,
binders = null
sql = "UPDATE bookmark SET id = ? WHERE id = ?",
parameters = 2,
binders = {
bindString(0, newPostId)
bindString(1, oldPostId)
}
)

driver.execute(
identifier = null,
sql = "UPDATE post_search SET id = '$newPostId' WHERE id = '$oldPostId'",
parameters = 0,
binders = null
sql = "UPDATE post_search SET id = ? WHERE id = ?",
parameters = 2,
binders = {
bindString(0, newPostId)
bindString(1, oldPostId)
}
)

driver.execute(
identifier = null,
sql = "UPDATE post SET id = '$newPostId' WHERE id = '$oldPostId'",
parameters = 0,
binders = null
sql = "UPDATE post SET id = ? WHERE id = ?",
parameters = 2,
binders = {
bindString(0, newPostId)
bindString(1, oldPostId)
}
)
}
}
Expand Down

0 comments on commit 71c5ac3

Please sign in to comment.