Skip to content

Commit e40cfce

Browse files
committed
fix: remove duplicate supabase migration version
1 parent 369d1d0 commit e40cfce

4 files changed

Lines changed: 26 additions & 7 deletions

File tree

docs/plans/2026-03-23-data-driven-item-and-encounter-implementation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ Add a short verification note to this plan or a follow-up handoff doc describing
296296

297297
**Verification Notes**
298298

299-
- `game.item_defs` was added in [2026032301_add_item_defs_table.sql](C:/Users/james/source/repos/extractor-shooter-light/.worktrees/data-driven-authoring/supabase/migrations/2026032301_add_item_defs_table.sql) with 22 seeded rows and parity-oriented fallback defaults.
299+
- `game.item_defs` was added in [20260323015_add_item_defs_table.sql](C:/Users/james/source/repos/extractor-shooter-light/.worktrees/data-driven-authoring/supabase/migrations/20260323015_add_item_defs_table.sql) with 22 seeded rows and parity-oriented fallback defaults.
300300
- `game.authored_item`, `game.weapon_magazine_capacity`, `game.backpack_capacity`, `game.weapon_armor_penetration`, `game.armor_damage_reduction`, `game.weapon_supports_*`, `game.weapon_burst_attack_penalty`, and `game.roll_weapon_damage_d20` were redefined in the same migration to read from `game.item_defs`.
301301
- Table-backed lookup functions that were previously marked `immutable` were downgraded to `stable` because they now depend on persisted row data.
302302
- Current callers remain untouched and continue to use the same function names. This kept phase 1 isolated to schema and lookup logic.

docs/plans/2026-03-23-item-key-lookups-and-shared-selection-helpers.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
### Duplicate-Pattern Checklist
1414

15-
- repeated `select ... from game.item_defs where name = ... and enabled` in `game.authored_item` and the item stat helpers currently redefined in `supabase/migrations/2026032301_add_item_defs_table.sql`
15+
- repeated `select ... from game.item_defs where name = ... and enabled` in `game.authored_item` and the item stat helpers currently redefined in `supabase/migrations/20260323015_add_item_defs_table.sql`
1616
- repeated weighted running-sum selection CTEs in `game.random_enemy_loadout_from_table`, `game.random_loot_items_from_table`, and both extraction/default encounter branches in `game.generate_raid_encounter` from `supabase/migrations/2026032302_add_authored_loot_and_encounter_tables.sql`
1717
- repeated joins from authored variant item tables back to `game.item_defs` in enemy-loadout and loot-table JSON generation in `supabase/migrations/2026032302_add_authored_loot_and_encounter_tables.sql`
1818
- repeated name-based stat lookups in combat/action code, with the latest effective `game.perform_raid_action` definition still in `supabase/migrations/2026032205_remove_gun_malfunctions_and_clear_jams.sql`
@@ -21,7 +21,7 @@
2121

2222
`rg -n "create or replace function game\.(authored_item|weapon_magazine_capacity|backpack_capacity|weapon_armor_penetration|armor_damage_reduction|weapon_supports_single_shot|weapon_supports_burst_fire|weapon_supports_full_auto|weapon_burst_attack_penalty|roll_weapon_damage_d20|random_enemy_loadout_from_table|random_loot_items_from_table|generate_raid_encounter|perform_raid_action)" supabase/migrations` currently resolves the latest definitions to:
2323

24-
- `supabase/migrations/2026032301_add_item_defs_table.sql` for `game.authored_item` and the item stat helper layer
24+
- `supabase/migrations/20260323015_add_item_defs_table.sql` for `game.authored_item` and the item stat helper layer
2525
- `supabase/migrations/2026032302_add_authored_loot_and_encounter_tables.sql` for authored weighted selection and encounter generation
2626
- `supabase/migrations/2026032205_remove_gun_malfunctions_and_clear_jams.sql` for the latest effective `game.perform_raid_action`
2727

@@ -36,7 +36,7 @@
3636

3737
**Files:**
3838
- Modify: `C:/Users/james/source/repos/extractor-shooter-light/.worktrees/data-driven-authoring/docs/plans/2026-03-23-item-key-lookups-and-shared-selection-helpers.md`
39-
- Reference: `C:/Users/james/source/repos/extractor-shooter-light/.worktrees/data-driven-authoring/supabase/migrations/2026032301_add_item_defs_table.sql`
39+
- Reference: `C:/Users/james/source/repos/extractor-shooter-light/.worktrees/data-driven-authoring/supabase/migrations/20260323015_add_item_defs_table.sql`
4040
- Reference: `C:/Users/james/source/repos/extractor-shooter-light/.worktrees/data-driven-authoring/supabase/migrations/2026032302_add_authored_loot_and_encounter_tables.sql`
4141
- Reference: `C:/Users/james/source/repos/extractor-shooter-light/.worktrees/data-driven-authoring/supabase/migrations/2026032205_remove_gun_malfunctions_and_clear_jams.sql`
4242

@@ -74,7 +74,7 @@ git commit -m "docs: inventory duplicate lookup patterns"
7474

7575
**Files:**
7676
- Create: `C:/Users/james/source/repos/extractor-shooter-light/.worktrees/data-driven-authoring/supabase/migrations/2026032303_add_item_lookup_helpers.sql`
77-
- Reference: `C:/Users/james/source/repos/extractor-shooter-light/.worktrees/data-driven-authoring/supabase/migrations/2026032301_add_item_defs_table.sql`
77+
- Reference: `C:/Users/james/source/repos/extractor-shooter-light/.worktrees/data-driven-authoring/supabase/migrations/20260323015_add_item_defs_table.sql`
7878

7979
**Step 1: Write the failing verification queries in migration notes**
8080

@@ -122,7 +122,7 @@ git commit -m "feat: add canonical item lookup helpers"
122122

123123
**Files:**
124124
- Modify: `C:/Users/james/source/repos/extractor-shooter-light/.worktrees/data-driven-authoring/supabase/migrations/2026032303_add_item_lookup_helpers.sql`
125-
- Reference: `C:/Users/james/source/repos/extractor-shooter-light/.worktrees/data-driven-authoring/supabase/migrations/2026032301_add_item_defs_table.sql`
125+
- Reference: `C:/Users/james/source/repos/extractor-shooter-light/.worktrees/data-driven-authoring/supabase/migrations/20260323015_add_item_defs_table.sql`
126126

127127
**Step 1: Write parity checks**
128128

@@ -235,7 +235,7 @@ git commit -m "refactor: share weighted selection logic across authored generato
235235

236236
**Files:**
237237
- Create: `C:/Users/james/source/repos/extractor-shooter-light/.worktrees/data-driven-authoring/supabase/migrations/2026032305_add_internal_item_key_usage.sql`
238-
- Reference: `C:/Users/james/source/repos/extractor-shooter-light/.worktrees/data-driven-authoring/supabase/migrations/2026032301_add_item_defs_table.sql`
238+
- Reference: `C:/Users/james/source/repos/extractor-shooter-light/.worktrees/data-driven-authoring/supabase/migrations/20260323015_add_item_defs_table.sql`
239239
- Reference: `C:/Users/james/source/repos/extractor-shooter-light/.worktrees/data-driven-authoring/supabase/migrations/2026032302_add_authored_loot_and_encounter_tables.sql`
240240

241241
**Step 1: Define the compatibility rule**

supabase/migrations/2026032301_add_item_defs_table.sql renamed to supabase/migrations/20260323015_add_item_defs_table.sql

File renamed without changes.

tests/RaidLoop.Core.Tests/HomeMarkupBindingTests.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.IO;
2+
using System.Linq;
23

34
namespace RaidLoop.Core.Tests;
45

@@ -617,6 +618,24 @@ public void MaxHealthHotfixMigrationRepairsNonPositiveSavedMaxHealthValues()
617618
Assert.Contains("payload is distinct from game.normalize_save_payload(payload)", migration);
618619
}
619620

621+
[Fact]
622+
public void SupabaseMigrationVersionsAreUnique()
623+
{
624+
var migrationDirectory = Path.GetFullPath(
625+
Path.Combine(AppContext.BaseDirectory, "..", "..", "..", "..", "..", "supabase", "migrations"));
626+
627+
var duplicateVersions = Directory.GetFiles(migrationDirectory, "*.sql")
628+
.Select(Path.GetFileNameWithoutExtension)
629+
.Where(static name => !string.IsNullOrWhiteSpace(name))
630+
.Select(static name => name!)
631+
.GroupBy(static name => name.Split('_')[0], StringComparer.Ordinal)
632+
.Where(group => group.Count() > 1)
633+
.Select(group => $"{group.Key}: {string.Join(", ", group.OrderBy(name => name, StringComparer.Ordinal))}")
634+
.ToArray();
635+
636+
Assert.Empty(duplicateVersions);
637+
}
638+
620639
[Fact]
621640
public void WeaponArmorPenetrationMigrationAddsReusablePenetrationAndArmorMitigationHelpers()
622641
{

0 commit comments

Comments
 (0)