fix(demo-seed): stop truncating ingredient/table ids to 36 chars
CI/CD / CI · API (dotnet build + test) (push) Successful in 1m9s
CI/CD / CI · Admin API (dotnet build) (push) Successful in 47s
CI/CD / CI · Dashboard (tsc) (push) Successful in 1m6s
CI/CD / CI · Admin Web (tsc) (push) Successful in 36s
CI/CD / CI · Website (tsc) (push) Successful in 44s
CI/CD / CI · Koja (tsc) (push) Successful in 50s
CI/CD / Deploy · all services (push) Successful in 1m24s
CI/CD / CI · API (dotnet build + test) (push) Successful in 1m9s
CI/CD / CI · Admin API (dotnet build) (push) Successful in 47s
CI/CD / CI · Dashboard (tsc) (push) Successful in 1m6s
CI/CD / CI · Admin Web (tsc) (push) Successful in 36s
CI/CD / CI · Website (tsc) (push) Successful in 44s
CI/CD / CI · Koja (tsc) (push) Successful in 50s
CI/CD / Deploy · all services (push) Successful in 1m24s
BuildDemoIngredients/BuildDemoTables built ids as
"{cafeId}_ing_{guid}"[..36]. For a real cafe (32-char hex id) the
first 36 chars are just "{cafeId}_ing" — the unique guid is cut off,
so all 15 ingredients (and all 10 tables) get the SAME id, causing a
primary-key collision on SaveChanges -> 500. cafe_demo_001 has a short
id so the guid survived, which is why the bug only hit real cafes.
The Id columns are text (no length limit), so the truncation served no
purpose. Removed [..36] from both so the full unique id is kept.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -130,7 +130,10 @@ public class DemoSeedService : IDemoSeedService
|
|||||||
decimal qty, decimal reorder, decimal cost, decimal par) =>
|
decimal qty, decimal reorder, decimal cost, decimal par) =>
|
||||||
new()
|
new()
|
||||||
{
|
{
|
||||||
Id = $"{cafeId}_ing_{Guid.NewGuid():N}"[..36],
|
// No [..36] truncation: Id is a text column, and truncating to 36 chars
|
||||||
|
// cuts off the unique guid for real (32-char) café ids → every row gets
|
||||||
|
// the same id → PK collision → 500. Keep the full unique id.
|
||||||
|
Id = $"{cafeId}_ing_{Guid.NewGuid():N}",
|
||||||
CafeId = cafeId,
|
CafeId = cafeId,
|
||||||
Name = name,
|
Name = name,
|
||||||
Unit = unit,
|
Unit = unit,
|
||||||
@@ -160,7 +163,9 @@ public class DemoSeedService : IDemoSeedService
|
|||||||
string cafeId, string branchId, string number, int capacity, string floor, int sortOrder) =>
|
string cafeId, string branchId, string number, int capacity, string floor, int sortOrder) =>
|
||||||
new()
|
new()
|
||||||
{
|
{
|
||||||
Id = $"{cafeId}_tbl_{Guid.NewGuid():N}"[..36],
|
// No [..36] truncation (see Ingredient above): truncating cuts the guid
|
||||||
|
// for real 32-char café ids → identical ids → PK collision → 500.
|
||||||
|
Id = $"{cafeId}_tbl_{Guid.NewGuid():N}",
|
||||||
CafeId = cafeId,
|
CafeId = cafeId,
|
||||||
BranchId = branchId,
|
BranchId = branchId,
|
||||||
Number = number,
|
Number = number,
|
||||||
|
|||||||
Reference in New Issue
Block a user