aboutsummaryrefslogtreecommitdiff
path: root/engine/schema
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-11-20 14:31:36 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-11-20 14:31:36 +0000
commit28739d80e27d9b871c3805cfcd24c8065b543228 (patch)
tree6cef9abbf4e5f819765b22144efebd76a4adadc2 /engine/schema
parentfdb8894ca1d0ae7ba9595160465aa5ac6dc75e9b (diff)
downloadelgg-28739d80e27d9b871c3805cfcd24c8065b543228.tar.gz
elgg-28739d80e27d9b871c3805cfcd24c8065b543228.tar.bz2
Migrate plugin settings from plugin to new settigns store.
git-svn-id: https://code.elgg.org/elgg/trunk@2476 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/schema')
-rw-r--r--engine/schema/upgrades/2008111901.sql2
-rw-r--r--engine/schema/upgrades/2008112001.sql24
2 files changed, 25 insertions, 1 deletions
diff --git a/engine/schema/upgrades/2008111901.sql b/engine/schema/upgrades/2008111901.sql
index 8ff20c626..7c27c9c50 100644
--- a/engine/schema/upgrades/2008111901.sql
+++ b/engine/schema/upgrades/2008111901.sql
@@ -1,4 +1,4 @@
- CREATE TABLE IF NOT EXISTS `prefix_private_settings` (
+CREATE TABLE IF NOT EXISTS `prefix_private_settings` (
`id` INT NOT NULL auto_increment,
`entity_guid` INT NOT NULL ,
`name` VARCHAR( 32 ) NOT NULL ,
diff --git a/engine/schema/upgrades/2008112001.sql b/engine/schema/upgrades/2008112001.sql
new file mode 100644
index 000000000..b17e30a1e
--- /dev/null
+++ b/engine/schema/upgrades/2008112001.sql
@@ -0,0 +1,24 @@
+-- Move plugin 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='plugin' and type='object');
+
+-- Delete previous settings
+CREATE TEMPORARY TABLE __upgrade_2008112001_1 (
+ 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 = 'plugin'
+);
+
+DELETE FROM `prefix_metadata` WHERE id in (SELECT id from __upgrade_2008112001_1);
+
+--DROP TABLE __upgrade_2008112001_1; \ No newline at end of file