Samwilson has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/383304 )

Change subject: Set up local_preferences table
......................................................................

Set up local_preferences table

This adds a new local_preferences table, of exactly the same
design as the global_preferences and user_properties tables.

No integration into the rest of GlobalPreferences is done yet.

Change-Id: I8e15f1570f314cae63a38325589f3d4811919bc6
---
M includes/Hooks.php
R sql/create_global_preferences.sql
A sql/create_local_preferences.sql
3 files changed, 15 insertions(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GlobalPreferences 
refs/changes/04/383304/1

diff --git a/includes/Hooks.php b/includes/Hooks.php
index 5a461fb..7a35919 100644
--- a/includes/Hooks.php
+++ b/includes/Hooks.php
@@ -189,12 +189,18 @@
         */
        public static function onLoadExtensionSchemaUpdates( DatabaseUpdater 
$updater ) {
                global $wgGlobalPreferencesDB;
+
+               // Global preferences table.
                if ( is_null( $wgGlobalPreferencesDB ) || 
$wgGlobalPreferencesDB === wfWikiID() ) {
                        // Only add the table if it's supposed to be on this 
wiki.
-                       $sqlPath = __DIR__ . '/../schema.sql';
+                       $sqlPath = __DIR__ . 
'/../sql/create_global_preferences.sql';
                        $updater->addExtensionTable( 'global_preferences', 
$sqlPath );
                }
 
+               // Local preferences table.
+               $sqlPath = __DIR__ . '/../sql/create_local_preferences.sql';
+               $updater->addExtensionTable( 'local_preferences', $sqlPath );
+
                return true;
        }
 
diff --git a/schema.sql b/sql/create_global_preferences.sql
similarity index 100%
rename from schema.sql
rename to sql/create_global_preferences.sql
diff --git a/sql/create_local_preferences.sql b/sql/create_local_preferences.sql
new file mode 100644
index 0000000..c9af6fa
--- /dev/null
+++ b/sql/create_local_preferences.sql
@@ -0,0 +1,8 @@
+CREATE TABLE local_preferences (
+  gp_user INT(11) NOT NULL,
+  gp_property VARBINARY(255) NOT NULL,
+  gp_value BLOB
+) /*$wgDBTableOptions*/;
+
+CREATE UNIQUE INDEX /*i*/local_preferences_user_property ON 
/*_*/local_preferences (gp_user,gp_property);
+CREATE INDEX /*i*/local_preferences_property ON /*_*/local_preferences 
(gp_property);

-- 
To view, visit https://gerrit.wikimedia.org/r/383304
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8e15f1570f314cae63a38325589f3d4811919bc6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GlobalPreferences
Gerrit-Branch: master
Gerrit-Owner: Samwilson <s...@samwilson.id.au>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to