Centralize durable schema migration ownership

This commit is contained in:
ms2k 2026-07-19 01:20:18 +09:00
commit 069f3813ae
2 changed files with 354 additions and 350 deletions

View file

@ -9,7 +9,6 @@
mod authz;
mod error;
mod migrate;
mod oidc;
mod principal;
mod roles;
@ -22,7 +21,6 @@ pub use authz::{
resource_visibility,
};
pub use error::IdentityError;
pub use migrate::{migrate, migrator};
pub use oidc::{OidcConfig, OidcIdentityProvider, ZITADEL_PROJECT_ROLES_CLAIM, roles_from_names};
pub use principal::{ExternalIdentity, Principal, principal_id_for};
pub use roles::{

View file

@ -1,19 +0,0 @@
use remora_durable::DurableError;
use sqlx::PgPool;
/// Separate migration history from the DurableStore substrate so feature-package
/// versions do not collide with `remora-durable` in `_sqlx_migrations`.
const MIGRATION_TABLE: &str = "_remora_identity_migrations";
pub async fn migrate(pool: &PgPool) -> Result<(), DurableError> {
let mut migrator = sqlx::migrate!("./migrations");
migrator.dangerous_set_table_name(MIGRATION_TABLE);
migrator.run(pool).await?;
Ok(())
}
pub fn migrator() -> sqlx::migrate::Migrator {
let mut migrator = sqlx::migrate!("./migrations");
migrator.dangerous_set_table_name(MIGRATION_TABLE);
migrator
}