mirror of
https://github.com/DorkSquadRR/DorkNet.git
synced 2026-10-25 15:08:47 -07:00
test: guard both schema-delivery paths; fix playlist backfill defaults
Adds SchemaBootstrapParityTests, which closes the hole that let the missing-column outage ship green. Every other test runs against a FRESH database where EnsureCreated builds the whole model from the entities, so a column that only exists in the model always appears — the failure mode is invisible by construction. These two tests model an EXISTING database instead: - Every model table/column must be reachable via a committed migration OR an idempotent Ensure* patch. Something covered by neither reaches only brand-new databases, and every query touching it throws on a deployed server. - Anything added after the Initial migration must additionally appear as a Postgres ALTER/CREATE in DatabaseBootstrap, because that path is EnsureCreated-only and never replays migrations. This is precisely the rule PrivateInstances.RoomCode, Clubs.ClubChatEnabled and ChatMessages.ModerationState broke. The first test asserts the union rather than migrations alone: a large amount of schema legitimately predates the rule and lives only in the helpers. Tightening that is separate cleanup; what must never happen is a column covered by nothing. The helper-coverage parser reads the Ensure* SQL out of the source rather than executing the private methods, and handles both C# string styles the file mixes plus the loops that interpolate a column name (EnsureGameRewardColumnsAsync). Also fixes a real data bug found in review: the Client2023WireFixes migration backfilled SupportsJuniors/SupportsScreens/SupportsTeleportVR/SupportsWalkVR to false for existing rows, while the entity default is true. A C# property initializer is not a database default, so EF emitted false and every playlist predating the migration would have been silently marked as not supporting juniors, screens or either VR movement mode — the opposite of intent, and inconsistent with the bootstrap helper, which already used true.
This commit is contained in:
@@ -51,7 +51,7 @@ namespace DorkNet.Server.Migrations
|
||||
table: "Playlists",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
defaultValue: true);
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "SupportsLevelVoting",
|
||||
@@ -65,21 +65,21 @@ namespace DorkNet.Server.Migrations
|
||||
table: "Playlists",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
defaultValue: true);
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "SupportsTeleportVR",
|
||||
table: "Playlists",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
defaultValue: true);
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "SupportsWalkVR",
|
||||
table: "Playlists",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
defaultValue: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "WarningMask",
|
||||
|
||||
Reference in New Issue
Block a user