aboutsummaryrefslogtreecommitdiff
path: root/engine/schema
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-11-26 18:48:23 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-11-26 18:48:23 +0000
commit72ba5087f0144bec86adc9094780bfe8decfd6b0 (patch)
treec064809783535a5e3050e025f90b9375a9802c5a /engine/schema
parent50235f0c55cfe25cd7ec136932eca4e039e356d0 (diff)
downloadelgg-72ba5087f0144bec86adc9094780bfe8decfd6b0.tar.gz
elgg-72ba5087f0144bec86adc9094780bfe8decfd6b0.tar.bz2
Closes #571: Widgets now use private store for settings
git-svn-id: https://code.elgg.org/elgg/trunk@2491 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/schema')
-rw-r--r--engine/schema/upgrades/2008112601.sql27
1 files changed, 27 insertions, 0 deletions
diff --git a/engine/schema/upgrades/2008112601.sql b/engine/schema/upgrades/2008112601.sql
new file mode 100644
index 000000000..9ca9657de
--- /dev/null
+++ b/engine/schema/upgrades/2008112601.sql
@@ -0,0 +1,27 @@
+-- We now are using a extended class to handle this
+UPDATE `prefix_entity_subtypes` SET class='ElggPlugin' where type='object' and subtype='widget';
+
+-- Move widget settings to private store
+INSERT INTO `prefix_private_settings` (entity_guid, name, `value`)
+ SELECT e.guid as guid, name_string.string as name, value_string.string as `value` FROM `prefix_entities` e
+ JOIN `prefix_metadata` name_val ON e.guid=name_val.entity_guid
+ JOIN `prefix_metastrings` name_string ON name_val.name_id = name_string.id
+ JOIN `prefix_metastrings` value_string ON name_val.value_id = value_string.id
+ WHERE
+ e.type='object' AND
+ e.subtype in (SELECT id from `prefix_entity_subtypes` WHERE subtype='widget' and type='object');
+
+-- Delete previous settings
+CREATE TEMPORARY TABLE __upgrade_2008112601 (
+ SELECT distinct meta.id as id from `prefix_metadata` meta
+ JOIN `prefix_private_settings` settings ON meta.entity_guid = settings.entity_guid
+ JOIN `prefix_entities` e ON e.guid = meta.entity_guid
+ JOIN `prefix_entity_subtypes` subtypes ON subtypes.id = e.subtype
+ WHERE
+ e.type='object' AND
+ subtypes.subtype = 'widget'
+);
+
+DELETE FROM `prefix_metadata` WHERE id in (SELECT id from __upgrade_2008112601);
+
+DROP TABLE __upgrade_2008112001; \ No newline at end of file