Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions crates/core/src/db/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -558,9 +558,18 @@ mod test {
Ok(())
}

fn with_snapshotting(manual: bool) -> anyhow::Result<TestDB> {
Ok(if manual {
TestDB::durable_without_snapshot_repo()?
} else {
TestDB::durable()?
})
}

fn replay_event_table_schema_change(snapshot: TakeSnapshot) -> anyhow::Result<()> {
let auth_ctx = AuthCtx::for_testing();
let stdb = TestDB::durable()?;
let with_snapshot = matches!(snapshot, TakeSnapshot::BeforeAutomigration);
let stdb = with_snapshotting(with_snapshot)?;

let module_v1 = event_table_module(ProductType::from([
("old_payload", AlgebraicType::U64),
Expand All @@ -576,7 +585,7 @@ mod test {
stdb.commit_tx(tx)?;
}

if matches!(snapshot, TakeSnapshot::BeforeAutomigration) {
if with_snapshot {
take_snapshot(&stdb)?;
}

Expand Down Expand Up @@ -635,7 +644,8 @@ mod test {
/// permanently preventing the database from reopening.
fn replay_event_table_drop(snapshot: TakeSnapshot) -> anyhow::Result<()> {
let auth_ctx = AuthCtx::for_testing();
let stdb = TestDB::durable()?;
let with_snapshot = matches!(snapshot, TakeSnapshot::BeforeAutomigration);
let stdb = with_snapshotting(with_snapshot)?;

let module_v1 = event_table_module(ProductType::from([("payload", AlgebraicType::U64)]));
let module_v2 = empty_module();
Expand All @@ -659,7 +669,7 @@ mod test {
stdb.commit_tx(tx)?;
}

if matches!(snapshot, TakeSnapshot::BeforeAutomigration) {
if with_snapshot {
take_snapshot(&stdb)?;
}

Expand Down
Loading