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"));
|
||||
|
||||
let table_count: i64 = sqlx::query_scalar(
|
||||
"SELECT COUNT(*)::bigint
|
||||
FROM information_schema.tables
|
||||
WHERE table_schema = 'public'
|
||||
AND table_name IN (
|
||||
'mutation_records', 'principals', 'source_credentials', 'jobs',
|
||||
let missing_tables: Vec<String> = sqlx::query_scalar(
|
||||
"SELECT table_name
|
||||
FROM unnest(ARRAY[
|
||||
'mutation_records', 'principal_identities', 'source_credentials', 'jobs',
|
||||
'attempts', 'result_inventories', 'deletion_operations',
|
||||
'live_event_history_state', 'worker_descriptors',
|
||||
'remora_schema_state'
|
||||
)",
|
||||
'live_event_history_state', 'worker_descriptors', '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
|
||||
.expect("schema tables");
|
||||
assert_eq!(table_count, 10);
|
||||
assert!(
|
||||
missing_tables.is_empty(),
|
||||
"missing tables: {missing_tables:?}"
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
|
|
|||
Loading…
Reference in a new issue