FTA7700 commited on
Commit
add2feb
·
1 Parent(s): 8e0d072

Update v001_backdrop_cache_keys.rs

Browse files
api/src/upgrade/v001_backdrop_cache_keys.rs CHANGED
@@ -21,11 +21,11 @@ pub async fn run(
21
  /// Database step — idempotent.
22
  pub async fn run_db(db: &impl ConnectionTrait) -> Result<(), AppError> {
23
  let result = db
24
- .execute(sea_orm::Statement::from_string(
25
- sea_orm::DatabaseBackend::Sqlite,
26
  "UPDATE image_meta SET cache_key = replace(cache_key, '_b@', '_b_f@') \
27
- WHERE image_type = 'b' AND instr(cache_key, '_b@') > 0"
28
- .to_string(),
29
  ))
30
  .await?;
31
  tracing::info!(db_rows = result.rows_affected(), "backdrop cache keys migrated in DB (_b@ → _b_f@)");
 
21
  /// Database step — idempotent.
22
  pub async fn run_db(db: &impl ConnectionTrait) -> Result<(), AppError> {
23
  let result = db
24
+ .execute(sea_orm::Statement::from_sql_and_values(
25
+ sea_orm::DatabaseBackend::Postgres,
26
  "UPDATE image_meta SET cache_key = replace(cache_key, '_b@', '_b_f@') \
27
+ WHERE image_type = 'b' AND cache_key LIKE '%_b@%'",
28
+ [],
29
  ))
30
  .await?;
31
  tracing::info!(db_rows = result.rows_affected(), "backdrop cache keys migrated in DB (_b@ → _b_f@)");