Skip to content

Commit

Permalink
use utf8mb4 encoding. #324
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Jun 14, 2015
1 parent c1b397a commit 2b5f0bc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion config/database.yml
Expand Up @@ -9,7 +9,7 @@ postgresql: &postgres
defaults: &defaults
pool: <%= ENV['CONCURRENCY'].to_i %>
timeout: 5000
encoding: utf8
encoding: utf8mb4
database: <%= ENV['DB_NAME'] %>
username: <%= ENV['DB_USERNAME'] %>
password: <%= ENV['DB_PASSWORD'] %>
Expand Down
24 changes: 12 additions & 12 deletions db/migrate/20150611092528_change_utf8_encoding.rb
Expand Up @@ -17,13 +17,13 @@ def self.up
# execute "ALTER TABLE `#{table}` CHARACTER SET = utf8mb4;"
# end

# UTF8_TEXT_PAIRS.each do |table, col|
# execute "ALTER TABLE `#{table}` CHANGE `#{col}` `#{col}` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
# end
UTF8_TEXT_PAIRS.each do |table, col|
execute "ALTER TABLE `#{table}` CHANGE `#{col}` `#{col}` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
end

# UTF8_MEDIUMTEXT_PAIRS.each do |table, col|
# execute "ALTER TABLE `#{table}` CHANGE `#{col}` `#{col}` MEDIUMTEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
# end
UTF8_MEDIUMTEXT_PAIRS.each do |table, col|
execute "ALTER TABLE `#{table}` CHANGE `#{col}` `#{col}` MEDIUMTEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
end
end

def self.down
Expand All @@ -33,12 +33,12 @@ def self.down
# execute "ALTER TABLE `#{table}` CHARACTER SET = utf8;"
# end

# UTF8_TEXT_PAIRS.each do |table, col|
# execute "ALTER TABLE `#{table}` CHANGE `#{col}` `#{col}` TEXT CHARACTER SET utf8 COLLATE utf_unicode_ci;;"
# end
UTF8_TEXT_PAIRS.each do |table, col|
execute "ALTER TABLE `#{table}` CHANGE `#{col}` `#{col}` TEXT CHARACTER SET utf8 COLLATE utf_unicode_ci;;"
end

# UTF8_MEDIUMTEXT_PAIRS.each do |table, col|
# execute "ALTER TABLE `#{table}` CHANGE `#{col}` `#{col}` MEDIUMTEXT CHARACTER SET utf8 COLLATE utf_unicode_ci;;"
# end
UTF8_MEDIUMTEXT_PAIRS.each do |table, col|
execute "ALTER TABLE `#{table}` CHANGE `#{col}` `#{col}` MEDIUMTEXT CHARACTER SET utf8 COLLATE utf_unicode_ci;;"
end
end
end

0 comments on commit 2b5f0bc

Please sign in to comment.