2008112601.sql 1.2 KB

123456789101112131415161718192021222324252627
  1. -- We now are using a extended class to handle this
  2. UPDATE `prefix_entity_subtypes` SET class='ElggPlugin' where type='object' and subtype='widget';
  3. -- Move widget settings to private store
  4. INSERT INTO `prefix_private_settings` (entity_guid, name, `value`)
  5. SELECT e.guid as guid, name_string.string as name, value_string.string as `value` FROM `prefix_entities` e
  6. JOIN `prefix_metadata` name_val ON e.guid=name_val.entity_guid
  7. JOIN `prefix_metastrings` name_string ON name_val.name_id = name_string.id
  8. JOIN `prefix_metastrings` value_string ON name_val.value_id = value_string.id
  9. WHERE
  10. e.type='object' AND
  11. e.subtype in (SELECT id from `prefix_entity_subtypes` WHERE subtype='widget' and type='object');
  12. -- Delete previous settings
  13. CREATE TEMPORARY TABLE __upgrade_2008112601 (
  14. SELECT distinct meta.id as id from `prefix_metadata` meta
  15. JOIN `prefix_private_settings` settings ON meta.entity_guid = settings.entity_guid
  16. JOIN `prefix_entities` e ON e.guid = meta.entity_guid
  17. JOIN `prefix_entity_subtypes` subtypes ON subtypes.id = e.subtype
  18. WHERE
  19. e.type='object' AND
  20. subtypes.subtype = 'widget'
  21. );
  22. DELETE FROM `prefix_metadata` WHERE id in (SELECT id from __upgrade_2008112601);
  23. DROP TABLE __upgrade_2008112001;