Skip to content
Closed
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
21 changes: 21 additions & 0 deletions src/CoreTests/Bugs/Bug_4614_revision_column_int_for_IRevisioned.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,27 @@ await conn.CreateCommand(
(await readVersionColumnType(typeof(RevisionedDoc))).ShouldBe("bigint");
}

[Fact]
public async Task existing_9x_bigint_column_for_IRevisioned_is_tolerated_not_narrowed_assert_check()
{
// The reverse-direction safety: a deployment that already migrated to V9-with-bigint
// (before this fix) MUST NOT get force-narrowed to integer on the next apply — a
// `USING mt_version::integer` cast would silently truncate any out-of-range value.
// The diff treats bigint-actual + integer-desired as compatible (no SQL emitted).
StoreOptions(opts => opts.Schema.For<RevisionedDoc>());
await theStore.Storage.ApplyAllConfiguredChangesToDatabaseAsync();

await using (var conn = new NpgsqlConnection(ConnectionSource.ConnectionString))
{
await conn.OpenAsync();
await conn.CreateCommand(
$"alter table {SchemaName}.mt_doc_revisioneddoc alter column mt_version type bigint")
.ExecuteNonQueryAsync();
}

await theStore.Storage.Database.AssertDatabaseMatchesConfigurationAsync().ShouldNotThrowAsync();
}

// ---- CRUD round-trip on both shapes ----

[Fact]
Expand Down
Loading