summaryrefslogtreecommitdiff
path: root/www/wiki/maintenance/sqlite/archives/patch-user_properties-fix-pk.sql
blob: 8362d23365bc9d37156e299772bf23691c27c751 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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);