Guest User

Untitled

a guest
May 12th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. class ConvertMessageToUtf8mb4 < ActiveRecord::Migration
  2.  
  3. def change
  4. reversible do |dir|
  5. dir.up do
  6. execute "ALTER TABLE live_reports CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;"
  7.  
  8. execute "ALTER TABLE live_reports CHANGE message message VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;"
  9. end
  10.  
  11. dir.down do
  12. execute "ALTER TABLE live_reports CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;"
  13.  
  14. execute "ALTER TABLE live_reports CHANGE message message VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci;"
  15. end
  16. end
  17. end
  18.  
  19. end
  20.  
  21.  
  22. development:
  23. adapter: mysql2
  24. database: omz
  25. # encoding: utf8
  26. username:
  27. password:
  28. host: localhost
  29. encoding: utf8mb4
  30. collation: utf8mb4_unicode_ci
Add Comment
Please, Sign In to add comment