wiki.techinc.nl/maintenance/sqlite/archives/patch-user_properties-fix-pk.sql
Reedy 634024b030 Fixup some SELECT * usages in sqlite schema patches
Bug: T252311
Change-Id: I7abdb7db89873c20f3a79df9452ab45c59ca6395
2020-05-10 02:21:37 +01:00

20 lines
642 B
SQL

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(up_user, up_property, up_value)
SELECT up_user, up_property, up_value 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);