diff --git a/include/upgrader/streams/core/9143a511-00000000.cleanup.sql b/include/upgrader/streams/core/9143a511-00000000.cleanup.sql index c04fdad7a2cd7845fa6d493de507a69da5ef14a4..3095f761ba864e6a6c7166cfe5358ed309c3d124 100644 --- a/include/upgrader/streams/core/9143a511-00000000.cleanup.sql +++ b/include/upgrader/streams/core/9143a511-00000000.cleanup.sql @@ -61,3 +61,9 @@ WHERE `key`='transient' AND `namespace` LIKE 'sla.%'; DELETE FROM `%TABLE_PREFIX%config` WHERE `key`='configuration' AND `namespace` LIKE 'list.%'; + +-- Orphan users who don't know they're orphans +UPDATE `%TABLE_PREFIX%user` A1 + LEFT JOIN `%TABLE_PREFIX%organization` A2 ON (A1.`org_id` = A2.`id`) + SET A1.`org_id` = 0 + WHERE A2.`id` IS NULL;