#Database seeding problem (logical)
11 messages · Page 1 of 1 (latest)
No
I think there is no way so i made test correct variant nullable fk
Probably this is relational db drawback altough i never use other kinda db
U can use this
Example
VALUES
(1, NULL), -- Test 1, no correct variant yet
(2, NULL); -- Test 2, no correct variant yet
INSERT INTO TestVariants (test_variant_id, test_id)
VALUES
(1, 1), -- Test variant 1 for Test 1
(2, 1), -- Test variant 2 for Test 1
(3, 2), -- Test variant 3 for Test 2
(4, 2); -- Test variant 4 for Test 2
UPDATE Tests SET correct_variant_id = 2 WHERE test_id = 1;
UPDATE Tests SET correct_variant_id = 4 WHERE test_id = 2;
yes exactly but issue was i made both variant and tests primary key without nullable :)))
but it really weird why mysql even let that scenario
it is literally paradox
no escape