fix(migrations): adopt published ledgerless baseline
CI / Rust Checks (push) Successful in 13m55s
CI / UI Checks (push) Successful in 5s
CI / Community Image Smoke (push) Successful in 6m14s
CI / Frontend E2E (push) Successful in 7m11s
CI / Deploy (push) Failing after 44s

This commit is contained in:
bsodfather committed 2026-09-01 23:01:33 +03:00
1 parent 527efb510f
commit 2759fde81f
7 files changed
+572 -21

No files matched your search

@@ -325,6 +325,15 @@ pub(super) async fn validate_schema_fingerprint(
.iter()
.filter_map(|row| row.try_get::<String, _>("column_name").ok())
.collect::<Vec<_>>();
let required = required
.iter()
.copied()
.filter(|column| {
!(current_version == 1
&& *table == "__crank_ext_migrations"
&& *column == "checksum")
})
.collect::<Vec<_>>();
if actual.len() != required.len()
|| required
.iter()
@@ -337,6 +346,9 @@ pub(super) async fn validate_schema_fingerprint(
if !relation_exists(connection, table).await? {
continue;
}
if current_version == 1 && *table == "__crank_ext_migrations" && *column == "checksum" {
continue;
}
let row = query(
"select data_type, is_nullable from information_schema.columns
where table_schema = current_schema() and table_name = $1 and column_name = $2",
@@ -424,23 +436,25 @@ pub(super) async fn validate_schema_fingerprint(
return Err(schema_error(current_version));
}
}
let required_indexes = [
"mcp_transport_sessions_workspace_agent_idx",
"mcp_transport_sessions_expires_at_idx",
];
for index in required_indexes {
let present = query(
"select exists (select 1 from pg_catalog.pg_indexes
where schemaname = current_schema() and indexname = $1) as present",
)
.bind(index)
.fetch_one(&mut *connection)
.await
.map_err(|_| MigrationError::storage("preflight.schema"))?
.try_get::<bool, _>("present")
.map_err(|_| MigrationError::storage("preflight.schema"))?;
if !present {
return Err(schema_error(current_version));
if relation_exists(connection, "mcp_transport_sessions").await? {
let required_indexes = [
"mcp_transport_sessions_workspace_agent_idx",
"mcp_transport_sessions_expires_at_idx",
];
for index in required_indexes {
let present = query(
"select exists (select 1 from pg_catalog.pg_indexes
where schemaname = current_schema() and indexname = $1) as present",
)
.bind(index)
.fetch_one(&mut *connection)
.await
.map_err(|_| MigrationError::storage("preflight.schema"))?
.try_get::<bool, _>("present")
.map_err(|_| MigrationError::storage("preflight.schema"))?;
if !present {
return Err(schema_error(current_version));
}
}
}
if current_version >= 3 {