Centralize durable schema migration ownership

This commit is contained in:
ms2k 2026-07-19 01:20:18 +09:00
commit 069f3813ae

View file

@ -7,9 +7,10 @@ use remora_durable::{
ADVISORY_CLASS_APP, CursorCodec, DurableError, KeysetPosition, MutationDisposition,
MutationStatus, OutboxClaim, OutboxClaimFilter, PoolConfig, advisory_key, advisory_xact_lock,
cas_set_text, claim_batch, claim_batch_in_tx, connect, enqueue, enqueue_after,
execute_mutation, first_page_cursor, mark_projected, mark_projected_pool, migrate,
next_page_cursor, release_with_error, unprojected_count, with_transaction,
execute_mutation, first_page_cursor, mark_projected, mark_projected_pool, next_page_cursor,
release_with_error, unprojected_count, with_transaction,
};
use remora_schema::migrate as migrate_schema;
use serde_json::json;
use sqlx::PgPool;
use time::{Duration as TimeDuration, OffsetDateTime};
@ -39,7 +40,7 @@ async fn test_pool() -> Option<PgPool> {
)
.await
.expect("connect to postgres");
migrate(&pool).await.expect("run substrate migrations");
migrate_schema(&pool).await.expect("run schema migrations");
Some(pool)
}
@ -85,7 +86,7 @@ async fn migration_round_trip_is_idempotent() {
let Some(pool) = test_pool().await else {
return;
};
migrate(&pool).await.expect("second migrate");
migrate_schema(&pool).await.expect("second migrate");
let (table_count,): (i64,) = sqlx::query_as(
"SELECT COUNT(*)::bigint
FROM information_schema.tables
@ -97,8 +98,6 @@ async fn migration_round_trip_is_idempotent() {
.expect("count substrate tables");
assert_eq!(table_count, 2);
let applied = remora_durable::migrator().iter().count();
assert_eq!(applied, 1);
let (version_count,): (i64,) = sqlx::query_as("SELECT COUNT(*)::bigint FROM _sqlx_migrations")
.fetch_one(&pool)
.await