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

use latin1 in case of mysql #84

Merged
merged 2 commits into from
Apr 19, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion lib/generators/unread/migration/templates/migration.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class UnreadMigration < Unread::MIGRATION_BASE_CLASS
def self.up
create_table ReadMark, force: true do |t|
create_table ReadMark, force: true, options: create_options do |t|
t.references :readable, polymorphic: { null: false }
t.references :reader, polymorphic: { null: false }
t.datetime :timestamp
Expand All @@ -12,4 +12,13 @@ def self.up
def self.down
drop_table ReadMark
end

def self.create_options
options = ''
if defined?(ActiveRecord::ConnectionAdapters::Mysql2Adapter) \
&& ActiveRecord::Base.connection.instance_of?(ActiveRecord::ConnectionAdapters::Mysql2Adapter)
options = 'DEFAULT CHARSET=latin1'
end
options
end
end