Skip to content

Commit 9c5c1f7

Browse files
committed
dbgen consistency
1 parent 8260082 commit 9c5c1f7

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

coderd/database/dbgen/dbgen.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,11 +396,14 @@ func ProvisionerJob(t testing.TB, db database.Store, ps pubsub.Pubsub, orig data
396396
orig.Tags[jobID.String()] = "true"
397397
}
398398

399+
// Attempt to alloc to the default org if exists
400+
defaultOrg, _ := db.GetDefaultOrganization(genCtx)
401+
399402
job, err := db.InsertProvisionerJob(genCtx, database.InsertProvisionerJobParams{
400403
ID: jobID,
401404
CreatedAt: takeFirst(orig.CreatedAt, dbtime.Now()),
402405
UpdatedAt: takeFirst(orig.UpdatedAt, dbtime.Now()),
403-
OrganizationID: takeFirst(orig.OrganizationID, uuid.New()),
406+
OrganizationID: takeFirst(orig.OrganizationID, defaultOrg.ID, uuid.New()),
404407
InitiatorID: takeFirst(orig.InitiatorID, uuid.New()),
405408
Provisioner: takeFirst(orig.Provisioner, database.ProvisionerTypeEcho),
406409
StorageMethod: takeFirst(orig.StorageMethod, database.ProvisionerStorageMethodFile),

coderd/database/queries/provisionerjobs.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ WHERE
2020
WHERE
2121
nested.started_at IS NULL
2222
-- Enforce hard organization boundary.
23-
AND nested.organization_id = @organization_id
23+
AND nested.organization_id = @organization_id
2424
-- Ensure the caller has the correct provisioner.
2525
AND nested.provisioner = ANY(@types :: provisioner_type [ ])
2626
AND CASE

0 commit comments

Comments
 (0)