wiki.techinc.nl/maintenance/sqlite/archives/patch-langlinks-ll_title-varbinary.sql
Amir Sarabadani 1770341562 Migrate langlinks to abstract schema
In order to migrate MySQL and Sqlite to abstract schema changed the
ll_title data type from varchar binary to varbinary. This wouldn't
affect production.

For migrating Postgres:
 - Dropping foreign key on ll_from
 - Setting default of empty string for ll_lang and ll_title
 - Make ll_lang and ll_title both non-nullable to be in sync with MySQL
 - Turning the unique index to primary key, similar to MySQL
 - Renaming an index to sync with MySQL

Bug: T164898
Bug: T230428
Change-Id: I57f22896ff67266f99bf08f6dd1b9cc4c51b1db9
2020-09-05 19:29:23 +02:00

14 lines
424 B
SQL

CREATE TABLE /*_*/langlinks_tmp (
ll_from INTEGER UNSIGNED DEFAULT 0 NOT NULL,
ll_lang BLOB DEFAULT '' NOT NULL,
ll_title BLOB DEFAULT '' NOT NULL,
PRIMARY KEY(ll_from, ll_lang)
);
INSERT INTO /*_*/langlinks_tmp
SELECT ll_from, ll_lang, ll_title
FROM /*_*/langlinks;
DROP TABLE /*_*/langlinks;
ALTER TABLE /*_*/langlinks_tmp RENAME TO /*_*/langlinks;
CREATE INDEX ll_lang ON /*_*/langlinks (ll_lang, ll_title);