materio-d9/patches/flag_lists_cleaning.md

1008 B

get each flagging_collection id wich related_flag does not exists

SELECT * FROM `flagging_collection`;
SELECT * FROM `flagging`;

for each flagging_collection

get the flag_lists_items ids form flag_list_item_field_data

SELECT * FROM `flag_list_item_field_data` WHERE `flag_list` LIKE 'FLAG_LIST_ID'

remove flag_list_items

DELETE FROM `flag_list_item` WHERE `id` = FLAG_LIST_ITEM_ID;

remove flag_list_item_field_data

DELETE FROM `flag_list_item_field_data` WHERE `id` = FLAG_LIST_ITEM_ID;

remove flagging_collection_revision

DELETE FROM `flagging_collection_revision` WHERE `id` = FLAG_LIST_ID;

remove flagging_collection_field_revision

DELETE FROM `flagging_collection_field_revision` WHERE `id` = FLAG_LIST_ID;

remove flagging_collection_field_data

DELETE FROM `flagging_collection_field_data` WHERE `id` = FLAG_LIST_ID;

remove flagging_collection

DELETE FROM `flagging_collection` WHERE `id` = FLAG_LIST_ID;