Skip to content

Commit

Permalink
Set MySQL collation: versions tbl: utf8mb4_general_ci
Browse files Browse the repository at this point in the history
Should fix the "Unknown collation: 'utf8mb4_col'" error from
#741
  • Loading branch information
jaredbeck committed Mar 31, 2016
1 parent b722f64 commit 0435936
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/generators/paper_trail/templates/create_versions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def change
#
def versions_table_options
if MYSQL_ADAPTERS.include?(connection.class.name)
{ options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_col" }
{ options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci" }
else
{}
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
it "uses utf8mb4_col collation" do
migration.change
expect(migration).to have_received(:create_table) do |_, arg2|
expect(arg2[:options]).to match(/COLLATE=utf8mb4_col/)
expect(arg2[:options]).to match(/COLLATE=utf8mb4_general_ci/)
end
end
else
Expand Down
2 changes: 1 addition & 1 deletion test/dummy/db/migrate/20110208155312_set_up_test_tables.rb
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ def down
def versions_table_options
opts = { force: true }
if MYSQL_ADAPTERS.include?(connection.class.name)
opts[:options] = "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_col"
opts[:options] = "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci"
end
opts
end
Expand Down

0 comments on commit 0435936

Please sign in to comment.