Skip to content
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