v0.3.4-pre.002-fix.001

This commit is contained in:
2026-08-30 21:17:38 +02:00
parent 6bd593f467
commit dfa3723a7f
6 changed files with 220 additions and 14 deletions

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-store-postgres-lib/unit_tests/schema.rs
// version: 5
// version: 6
fn actual_column(name: &str, udt_name: &str, nullable: bool) -> super::ActualColumn {
return super::ActualColumn {
@@ -62,6 +62,7 @@ fn pre_002_v002_resources_are_exactly_two_tables_plus_base_pk_fk_without_indexes
]
);
let sql = crate::V002_RESOURCES.iter().map(|resource| return resource.sql).collect::<std::vec::Vec<_>>().concat();
let normalized_sql = sql.split_ascii_whitespace().collect::<std::vec::Vec<_>>().join(" ");
for required in [
"CREATE TABLE IF NOT EXISTS ksp_raw_account_states",
"CREATE TABLE IF NOT EXISTS ksp_raw_account_observations",
@@ -71,10 +72,10 @@ fn pre_002_v002_resources_are_exactly_two_tables_plus_base_pk_fk_without_indexes
"PRIMARY KEY (observation_key)",
"FOREIGN KEY (account_pubkey, account_slot, account_state_hash) REFERENCES ksp_raw_account_states(pubkey, slot, state_hash) ON DELETE RESTRICT",
] {
assert!(sql.contains(required), "V002 pre.002 physical foundation is missing: {required}");
assert!(normalized_sql.contains(required), "V002 pre.002 physical foundation is missing: {required}");
}
for forbidden in ["CREATE INDEX", " CHECK ", "ON DELETE CASCADE", "BIGSERIAL", "slot BIGINT", "data TEXT"] {
assert!(!sql.contains(forbidden), "pre.002 advanced V002 beyond the minimal table/PK/FK scope: {forbidden}");
assert!(!normalized_sql.contains(forbidden), "pre.002 advanced V002 beyond the minimal table/PK/FK scope: {forbidden}");
}
return;
}