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

Candidate fix 2: Create inverse migration for utf8mb4 #23846

Merged
merged 2 commits into from Jul 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 17 additions & 0 deletions dashboard/db/migrate/20180721010612_rollback_utf8mb4.rb
@@ -0,0 +1,17 @@
class RollbackUtf8mb4 < ActiveRecord::Migration[5.0]
def up
execute 'alter table blocks convert to charset utf8 collate utf8_unicode_ci'
execute 'alter table blocks modify name varchar(255) charset utf8 collate utf8_unicode_ci'
execute 'alter table blocks modify category varchar(255) charset utf8 collate utf8_unicode_ci'
execute 'alter table blocks modify config text(21845) charset utf8 collate utf8_unicode_ci'
execute 'alter table blocks modify helper_code text(21845) charset utf8 collate utf8_unicode_ci'
end

def down
execute 'alter table blocks convert to charset utf8mb4 collate utf8mb4_unicode_ci'
execute 'alter table blocks modify name varchar(255) charset utf8mb4 collate utf8mb4_unicode_ci'
execute 'alter table blocks modify category varchar(255) charset utf8mb4 collate utf8mb4_unicode_ci'
execute 'alter table blocks modify config text(16383) charset utf8mb4 collate utf8mb4_unicode_ci'
execute 'alter table blocks modify helper_code text(16383) charset utf8mb4 collate utf8mb4_unicode_ci'
end
end
4 changes: 2 additions & 2 deletions dashboard/db/schema.rb
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20180719182514) do
ActiveRecord::Schema.define(version: 20180721010612) do

create_table "activities", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t|
t.integer "user_id"
Expand Down Expand Up @@ -88,7 +88,7 @@
t.index ["user_id", "script_id", "level_id", "hint_id"], name: "index_authored_hint_view_requests_on_all_related_ids", using: :btree
end

create_table "blocks", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
create_table "blocks", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t|
t.string "name"
t.string "pool", default: "", null: false
t.string "category"
Expand Down