Skip to content
This repository has been archived by the owner on Dec 22, 2022. It is now read-only.

Commit

Permalink
changed migration which will change db/table/col to utf8 encoding (#1810
Browse files Browse the repository at this point in the history
)

* 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.
  • Loading branch information
pgwillia authored Oct 25, 2019
1 parent 99bd93b commit 51f1c0e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 51f1c0e

Please sign in to comment.