X-Git-Url: https://scripts.mit.edu/gitweb/autoinstallsdev/mediawiki.git/blobdiff_plain/19e297c21b10b1b8a3acad5e73fc71dcb35db44a..6932310fd58ebef145fa01eb76edf7150284d8ea:/maintenance/sqlite/archives/patch-user_properties-fix-pk.sql

diff --git a/maintenance/sqlite/archives/patch-user_properties-fix-pk.sql b/maintenance/sqlite/archives/patch-user_properties-fix-pk.sql
new file mode 100644
index 00000000..8362d233
--- /dev/null
+++ b/maintenance/sqlite/archives/patch-user_properties-fix-pk.sql
@@ -0,0 +1,20 @@
+CREATE TABLE /*_*/user_properties_tmp (
+  -- Foreign key to user.user_id
+  up_user int NOT NULL,
+
+  -- Name of the option being saved. This is indexed for bulk lookup.
+  up_property varbinary(255) NOT NULL,
+
+  -- Property value as a string.
+  up_value blob,
+  PRIMARY KEY (up_user,up_property)
+) /*$wgDBTableOptions*/;
+
+INSERT INTO /*_*/user_properties_tmp
+	SELECT * FROM /*_*/user_properties;
+
+DROP TABLE /*_*/user_properties;
+
+ALTER TABLE /*_*/user_properties_tmp RENAME TO /*_*/user_properties;
+
+CREATE INDEX /*i*/user_properties_property ON /*_*/user_properties (up_property);
\ No newline at end of file
