From 51f1c0e5f5d094ce51422501f57fdcdfded663b8 Mon Sep 17 00:00:00 2001 From: pgwillia Date: Fri, 25 Oct 2019 12:57:08 -0600 Subject: [PATCH] changed migration which will change db/table/col to utf8 encoding (#1810) * changed migration which will change db/table/col to utf8 encoding Was originally going to the best practice standard of utf8mb4 but scaled back my ambition when we encounted column size too large. While we do want CJK characters (maybe even emojis) this won't break anything that isn't already broken. --- CHANGELOG.md | 3 +++ config/application.rb | 2 +- ...oding.rb => 20190314159265_change_to_utf8_encoding.rb} | 8 ++++---- 3 files changed, 8 insertions(+), 5 deletions(-) rename db/migrate/{20190314159265_change_to_utf8mb4_encoding.rb => 20190314159265_change_to_utf8_encoding.rb} (51%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 86a790665..9b99ca3cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,11 +6,14 @@ and releases in Discovery project adheres to [Semantic Versioning](http://semver ## [Unreleased] +## [3.0.112] - 2019-10-25 + ### Added - Add version file and meta generator tag [#1343](https://github.com/ualbertalib/discovery/issues/1343) ### Changed - for Docker add bundler build config to make sassc gem portable [#1796](https://github.com/ualbertalib/discovery/issues/1796) +- changed migration which will change db/table/col to utf8 encoding [#1800](https://github.com/ualbertalib/discovery/issues/1800) ## [3.0.111] - 2019-10-23 diff --git a/config/application.rb b/config/application.rb index 292e13d93..f2d259303 100755 --- a/config/application.rb +++ b/config/application.rb @@ -8,7 +8,7 @@ Bundler.require(*Rails.groups) module Discovery - VERSION = '3.0.11'.freeze # used in application layout meta generator tag + VERSION = '3.0.112'.freeze # used in application layout meta generator tag class Application < Rails::Application # Settings in config/environments/* take precedence over those specified here. diff --git a/db/migrate/20190314159265_change_to_utf8mb4_encoding.rb b/db/migrate/20190314159265_change_to_utf8_encoding.rb similarity index 51% rename from db/migrate/20190314159265_change_to_utf8mb4_encoding.rb rename to db/migrate/20190314159265_change_to_utf8_encoding.rb index b771714af..70902b70f 100644 --- a/db/migrate/20190314159265_change_to_utf8mb4_encoding.rb +++ b/db/migrate/20190314159265_change_to_utf8_encoding.rb @@ -1,13 +1,13 @@ -class ChangeToUtf8mb4Encoding < ActiveRecord::Migration +class ChangeToUtf8Encoding < ActiveRecord::Migration def change db = ActiveRecord::Base.connection - execute "ALTER DATABASE `#{db.current_database}` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" + execute "ALTER DATABASE `#{db.current_database}` CHARACTER SET utf8 COLLATE utf8_unicode_ci;" db.tables.each do |table| - execute "ALTER TABLE `#{table}` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" + execute "ALTER TABLE `#{table}` CHARACTER SET utf8 COLLATE utf8_unicode_ci;" - execute "ALTER TABLE `#{table}` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" + execute "ALTER TABLE `#{table}` CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;" end end