Difference between revisions of "Talk:Collation"

From Freephile Wiki
Jump to navigation Jump to search
(document what I did on my test host)
(No difference)

Revision as of 15:04, 25 April 2024

SET @DATABASE_NAME = 'wiki_greg';
SELECT 
    CONCAT("ALTER TABLE `",
            table_name,
            "` CHARACTER SET = 'binary' COLLATE = 'BINARY';") AS sql_statements
FROM
    information_schema.tables AS tb
WHERE
    table_schema = @DATABASE_NAME
        AND `TABLE_COLLATION` = 'latin1_swedish_ci'
        AND `TABLE_TYPE` = 'BASE TABLE'
        AND `tb`.table_name NOT REGEXP '.*searchindex'
ORDER BY table_name DESC;

First thing you need to do is use wiki_greg;

Then you can alter all the tables by copy/pasting all the generated lines. Altering table defaults will NOT change definitions on columns which specify CHARACTER SET or collation.

ALTER TABLE `archive` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `bad_behavior` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `blobs` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `brokenlinks` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `category` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `categorylinks` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `change_tag` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `cur` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `dune_hitcounter` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `external_user` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `externallinks` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `filearchive` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `image` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `imagelinks` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `interwiki` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `ipblocks` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `ipblocks_old` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `job` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `l10n_cache` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `langlinks` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `links` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `linkscc` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `linktarget` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `log_search` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `logging` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `math` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `objectcache` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `oldimage` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `online` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `page` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `page_props` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `page_restrictions` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `pagelinks` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `protected_titles` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `querycache` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `querycache_info` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `querycachetwo` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `recentchanges` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `redirect` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `revision` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `site_identifiers` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `site_stats` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `sites` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `templatelinks` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `text` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `trackbacks` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `updatelog` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `user` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `user_autocreate_serial` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `user_groups` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `user_newtalk` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `user_openid` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `user_properties` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `user_rights` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `validate` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `watchlist` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `watchlist_expiry` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `wiretap` CHARACTER SET = 'binary' COLLATE = 'BINARY';
ALTER TABLE `wiretap_counter_alltime` CHARACTER SET = 'binary' COLLATE = 'BINARY';