Commit edaff4e8 authored by Florian Azizian's avatar Florian Azizian

FIX #10764 TIME 0:30 added_by_entity not null in migration 1904

parent e7adda4f
......@@ -260,6 +260,14 @@ ALTER TABLE res_mark_as_read DROP COLUMN IF EXISTS coll_id;
UPDATE listinstance SET added_by_entity = 'superadmin' WHERE added_by_user = 'superadmin';
UPDATE listinstance SET added_by_entity = 'superadmin' WHERE listinstance_id IN
(SELECT listinstance_id FROM listinstance LEFT JOIN entities ON listinstance.added_by_entity = entities.entity_id WHERE entities.entity_id IS null);
UPDATE listinstance SET added_by_entity = 'superadmin' WHERE listinstance_id IN
(SELECT listinstance_id
FROM listinstance
LEFT JOIN users_entities ON listinstance.added_by_user = users_entities.user_id
LEFT JOIN entities ON users_entities.entity_id = entities.entity_id
WHERE primary_entity = 'Y' AND entities.entity_id IS NULL);
UPDATE listinstance SET added_by_entity =
(SELECT entity_id FROM users_entities WHERE users_entities.user_id = listinstance.added_by_user AND primary_entity = 'Y')
WHERE added_by_entity IS NULL OR added_by_entity = '';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment