Verify centralized schema tables by exact name
This commit is contained in:
parent
8a4999344d
commit
4ca7526d50
1 changed files with 14 additions and 12 deletions
|
|
@ -36,21 +36,23 @@ async fn migration_is_idempotent_and_marks_the_complete_generation() {
|
||||||
);
|
);
|
||||||
assert!(is_ready(&pool).await.expect("schema readiness"));
|
assert!(is_ready(&pool).await.expect("schema readiness"));
|
||||||
|
|
||||||
let table_count: i64 = sqlx::query_scalar(
|
let missing_tables: Vec<String> = sqlx::query_scalar(
|
||||||
"SELECT COUNT(*)::bigint
|
"SELECT table_name
|
||||||
FROM information_schema.tables
|
FROM unnest(ARRAY[
|
||||||
WHERE table_schema = 'public'
|
'mutation_records', 'principal_identities', 'source_credentials', 'jobs',
|
||||||
AND table_name IN (
|
|
||||||
'mutation_records', 'principals', 'source_credentials', 'jobs',
|
|
||||||
'attempts', 'result_inventories', 'deletion_operations',
|
'attempts', 'result_inventories', 'deletion_operations',
|
||||||
'live_event_history_state', 'worker_descriptors',
|
'live_event_history_state', 'worker_descriptors', 'remora_schema_state'
|
||||||
'remora_schema_state'
|
]) AS expected(table_name)
|
||||||
)",
|
WHERE to_regclass('public.' || table_name) IS NULL
|
||||||
|
ORDER BY table_name",
|
||||||
)
|
)
|
||||||
.fetch_one(&pool)
|
.fetch_all(&pool)
|
||||||
.await
|
.await
|
||||||
.expect("schema tables");
|
.expect("schema tables");
|
||||||
assert_eq!(table_count, 10);
|
assert!(
|
||||||
|
missing_tables.is_empty(),
|
||||||
|
"missing tables: {missing_tables:?}"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue