Centralize durable schema migration ownership
This commit is contained in:
parent
cc328237f4
commit
069f3813ae
1 changed files with 354 additions and 350 deletions
|
|
@ -4,11 +4,12 @@ use std::time::Duration;
|
|||
|
||||
use remora_credentials::{
|
||||
ActiveCredentialGrant, CreateCredential, CredentialCaller, CredentialGrantVersion,
|
||||
CredentialRegistry, GrantBoundResolver, SecretMaterial, VaultClient, VaultConfig, migrate,
|
||||
CredentialRegistry, GrantBoundResolver, SecretMaterial, VaultClient, VaultConfig,
|
||||
};
|
||||
use remora_domain::OpaqueId;
|
||||
use remora_domain::ports::CredentialResolver;
|
||||
use remora_durable::{PoolConfig, connect, migrate as durable_migrate};
|
||||
use remora_durable::{PoolConfig, connect};
|
||||
use remora_schema::migrate as migrate_schema;
|
||||
use sqlx::PgPool;
|
||||
use tokio::io::{AsyncReadExt, AsyncWriteExt};
|
||||
use tokio::net::{TcpListener, TcpStream};
|
||||
|
|
@ -57,8 +58,7 @@ async fn test_pool() -> Option<PgPool> {
|
|||
)
|
||||
.await
|
||||
.expect("connect postgres");
|
||||
durable_migrate(&pool).await.expect("durable migrate");
|
||||
migrate(&pool).await.expect("credentials migrate");
|
||||
migrate_schema(&pool).await.expect("schema migrate");
|
||||
Some(pool)
|
||||
}
|
||||
|
||||
|
|
@ -1218,8 +1218,8 @@ async fn migration_is_idempotent() {
|
|||
let Some(pool) = test_pool().await else {
|
||||
return;
|
||||
};
|
||||
migrate(&pool).await.expect("second");
|
||||
migrate(&pool).await.expect("third");
|
||||
migrate_schema(&pool).await.expect("second");
|
||||
migrate_schema(&pool).await.expect("third");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
|
@ -1245,10 +1245,12 @@ async fn version_coordinate_migration_backfills_populated_schema() {
|
|||
.execute(&mut *connection)
|
||||
.await
|
||||
.expect("select migration schema");
|
||||
sqlx::raw_sql(include_str!("../migrations/0001_credentials.sql"))
|
||||
.execute(&mut *connection)
|
||||
.await
|
||||
.expect("pre-coordinate schema");
|
||||
sqlx::raw_sql(include_str!(
|
||||
"../../remora-schema/migrations/credentials/0001_credentials.sql"
|
||||
))
|
||||
.execute(&mut *connection)
|
||||
.await
|
||||
.expect("pre-coordinate schema");
|
||||
sqlx::query(
|
||||
"INSERT INTO source_credentials (
|
||||
credential_id, owner_id, label, kind, status, active_version_id,
|
||||
|
|
@ -1274,7 +1276,7 @@ async fn version_coordinate_migration_backfills_populated_schema() {
|
|||
.await
|
||||
.expect("legacy version");
|
||||
sqlx::raw_sql(include_str!(
|
||||
"../migrations/0005_version_secret_coordinates.sql"
|
||||
"../../remora-schema/migrations/credentials/0005_version_secret_coordinates.sql"
|
||||
))
|
||||
.execute(&mut *connection)
|
||||
.await
|
||||
|
|
|
|||
Loading…
Reference in a new issue