-
-
Notifications
You must be signed in to change notification settings - Fork 90
Open
Labels
enhancementNew feature or requestNew feature or request
Description
I recently updated my bob version from 0.34.2 to 0.42.0. Afterwards i found my tests failing. All failing tests have similar issue of bob, creating unnecessary relations. Factory code example:
f.NewTask(
factory.TaskMods.WithNewExporters(1),
).CreateOrFail(t.Context(), t, bob.Debug(db))
Table task connects to exporter via m2m relation:
task -> task_exporter_id -> exporter
Relationships described in bob config:
relationships:
task:
- name: "task_to_exporters"
sides:
- from: "task"
to: "task_exporter_id"
columns: [ [ uuid, task_id ] ]
- from: "task_exporter_id"
to: "exporter"
columns: [ [ exporter_id, id ] ]
I expect that this code will create 1 task and 1 exporter associated with this task. However, in log i see creation of multiple tasks:
INSERT INTO "task" AS "task" ...
INSERT INTO "exporter" ...
INSERT INTO "task" AS "task" ...
INSERT INTO "task_exporter_id" AS "task_exporter_id"...
INSERT INTO "exporter" AS "exporter"...
UPDATE "task_exporter_id" AS "task_exporter_id" SET...
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request