mirror of
https://github.com/openai/codex.git
synced 2026-11-07 08:34:29 +00:00
## Why Revert #27910 to remove the newly introduced thread `recencyAt` persistence and API behavior from `main`. ## What changed This reverts commit `fac3158c2a783095768076489815f361fa9b0db4`, including the state migration, thread-store propagation, app-server API surface, generated schemas, and related tests. ## Validation Not run before opening; relying on CI for the initial fast signal.
42 lines
1.4 KiB
Rust
42 lines
1.4 KiB
Rust
use std::borrow::Cow;
|
|
|
|
use sqlx::migrate::Migrator;
|
|
|
|
pub(crate) static STATE_MIGRATOR: Migrator = sqlx::migrate!("./migrations");
|
|
pub(crate) static LOGS_MIGRATOR: Migrator = sqlx::migrate!("./logs_migrations");
|
|
pub(crate) static GOALS_MIGRATOR: Migrator = sqlx::migrate!("./goals_migrations");
|
|
pub(crate) static MEMORIES_MIGRATOR: Migrator = sqlx::migrate!("./memory_migrations");
|
|
|
|
/// Allow an older Codex binary to open a database that has already been
|
|
/// migrated by a newer binary running in parallel.
|
|
///
|
|
/// We intentionally ignore applied migration versions that are newer than the
|
|
/// embedded migration set. Known migration versions are still validated by
|
|
/// checksum, so this only relaxes the "database is ahead of me" case.
|
|
fn runtime_migrator(base: &'static Migrator) -> Migrator {
|
|
Migrator {
|
|
migrations: Cow::Borrowed(base.migrations.as_ref()),
|
|
ignore_missing: true,
|
|
locking: base.locking,
|
|
no_tx: base.no_tx,
|
|
table_name: base.table_name.clone(),
|
|
create_schemas: base.create_schemas.clone(),
|
|
}
|
|
}
|
|
|
|
pub(crate) fn runtime_state_migrator() -> Migrator {
|
|
runtime_migrator(&STATE_MIGRATOR)
|
|
}
|
|
|
|
pub(crate) fn runtime_logs_migrator() -> Migrator {
|
|
runtime_migrator(&LOGS_MIGRATOR)
|
|
}
|
|
|
|
pub(crate) fn runtime_goals_migrator() -> Migrator {
|
|
runtime_migrator(&GOALS_MIGRATOR)
|
|
}
|
|
|
|
pub(crate) fn runtime_memories_migrator() -> Migrator {
|
|
runtime_migrator(&MEMORIES_MIGRATOR)
|
|
}
|