Skip to content

Commit

Permalink
just allow the full-table scan
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkw committed Jul 29, 2024
1 parent 968318e commit cc88786
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions dev-tools/omdb/src/bin/omdb/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4247,13 +4247,21 @@ async fn cmd_db_migrations_list(
deleted: Option<chrono::DateTime<Utc>>,
}

let migrations = query
.limit(i64::from(u32::from(fetch_opts.fetch_limit)))
.order_by(dsl::time_created)
.select(Migration::as_select())
.load_async(&*datastore.pool_connection_for_tests().await?)
.await
.context("listing migrations")?;
let migrations = datastore
.pool_connection_for_tests()
.await?
.transaction_async(|conn| async move {
// Selecting all migration records requires a full table scan
conn.batch_execute_async(ALLOW_FULL_TABLE_SCAN_SQL).await?;
query
.limit(i64::from(u32::from(fetch_opts.fetch_limit)))
.order_by(dsl::time_created)
.select(Migration::as_select())
.load_async(&conn)
.await
.context("listing migrations")
})
.await?;

check_limit(&migrations, fetch_opts.fetch_limit, || "listing migrations");

Expand Down

0 comments on commit cc88786

Please sign in to comment.