Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MakeFullUnicode and add more unicode columns. #886

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions OZprivate/ServerScripts/SQL/create_db_indexes.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ CREATE PROCEDURE MakeFullUnicode(tablename CHAR(50), columnname CHAR(50))
BEGIN
DECLARE char_set TEXT;
DECLARE vtype TEXT;
DECLARE coll_name TEXT;

SELECT character_set_name, column_type INTO char_set, vtype FROM information_schema.`COLUMNS`
SELECT character_set_name, column_type, collation_name INTO char_set, vtype, coll_name FROM information_schema.`COLUMNS`
WHERE table_schema = SCHEMA() AND table_name = tablename AND column_name = columnname;
IF char_set != 'utf8mb4' THEN
SET @sql_cmd = CONCAT('ALTER TABLE ', tablename,' CONVERT TO CHARACTER SET utf8mb4;');
IF char_set != 'utf8mb4' OR coll_name != 'utf8mb4_unicode_ci' THEN
SET @sql_cmd = CONCAT('ALTER TABLE ', tablename,' DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;');
PREPARE stmt FROM @sql_cmd;
EXECUTE stmt;
SET @sql_cmd = CONCAT('ALTER TABLE ', tablename,' CHANGE ', columnname, ' ', columnname, ' ', vtype, ' CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;');
Expand All @@ -30,6 +31,11 @@ CREATE PROCEDURE MakeFullUnicode(tablename CHAR(50), columnname CHAR(50))

DELIMITER ;

call MakeFullUnicode('vernacular_by_name', 'name');
call MakeFullUnicode('images_by_name', 'name');
call MakeFullUnicode('ordered_leaves', 'name');
call MakeFullUnicode('ordered_nodes', 'name');

#with an innoDB server, you may get ignorable errors like 'The storage engine for the table doesn't support repair'
call MakeFullUnicode('vernacular_by_ott', 'vernacular');
call MakeFullUnicode('vernacular_by_name', 'vernacular');
Expand Down