-
-
Notifications
You must be signed in to change notification settings - Fork 5
Some assignments are lost on update #25
Copy link
Copy link
Open
Description
Describe the bug
On update, assignments that are already synced before are dropped by the server.
To Reproduce
Steps to reproduce the behavior:
- Create an draw, sync and add a team
- Create two task, assign one
- Update
- Assign the other task
- Update
- Open WebUI to see the result
- Repeat (5) and see only one (alternating) task with an assignment
Related lines
Wasabee-Server/model/database.go
Line 59 in 76a7f79
| {"assignments", `CREATE TABLE assignments (opID char(40) NOT NULL, taskID char(40) NOT NULL, gid char(21) NOT NULL, KEY opID (opID), KEY gid (gid), CONSTRAINT fk_assignments_gid FOREIGN KEY (gid) REFERENCES agent (gid) ON DELETE CASCADE, CONSTRAINT fk_assignments_opid FOREIGN KEY (opID) REFERENCES operation (ID) ON DELETE CASCADE, KEY taskID (taskID,opID), CONSTRAINT fk_assignments_taskid FOREIGN KEY (taskID,opID) REFERENCES task (ID, opID) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;`}, |
CREATE TABLE assignments (
opID char(40) NOT NULL,
taskID char(40) NOT NULL,
gid char(21) NOT NULL,
KEY opID (opID),
KEY gid (gid),
CONSTRAINT fk_assignments_gid FOREIGN KEY (gid) REFERENCES agent (gid) ON DELETE CASCADE,
CONSTRAINT fk_assignments_opid FOREIGN KEY (opID) REFERENCES operation (ID) ON DELETE CASCADE,
KEY taskID (taskID,opID),
CONSTRAINT fk_assignments_taskid FOREIGN KEY (taskID,opID) REFERENCES task (ID, opID) ON DELETE CASCADE
);Wasabee-Server/model/markers.go
Line 118 in 76a7f79
| _, err := tx.Exec("REPLACE INTO task (ID, opID, comment, taskorder, state, zone, delta) VALUES (?, ?, ?, ?, ?, ?, ?)", // REPLACE OK SCB |
I suspect we get the correct list here:
Line 200 in 76a7f79
| b, err := t.GetAssignments(tx) |
so, already synced assignments are not "replaced", but the data is deleted following the cascade deletion due to the
REPLACE INTO query.Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels