Module: MysqlOnlineMigrations
- Includes:
- Columns, Indexes
- Defined in:
- lib/mysql_online_migrations.rb,
lib/mysql_online_migrations/columns.rb,
lib/mysql_online_migrations/indexes.rb
Defined Under Namespace
Modules: Columns, Indexes
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Columns
#add_column, #add_timestamps, #change_column, #remove_column, #remove_timestamps, #rename_column
Methods included from Indexes
#add_index, #remove_index, #rename_index
Class Method Details
.included(base) ⇒ Object
12
13
14
15
|
# File 'lib/mysql_online_migrations.rb', line 12
def self.included(base)
ActiveRecord::Base.send(:class_attribute, :mysql_online_migrations, :instance_writer => false)
ActiveRecord::Base.send("mysql_online_migrations=", true)
end
|
Instance Method Details
24
25
26
|
# File 'lib/mysql_online_migrations.rb', line 24
def (options)
[options[:lock], options.except(:lock)]
end
|
#lock_statement(lock, with_comma = false) ⇒ Object
17
18
19
20
21
22
|
# File 'lib/mysql_online_migrations.rb', line 17
def lock_statement(lock, with_comma = false)
return "" if lock == true
return "" unless perform_migrations_online?
puts "ONLINE MIGRATION"
"#{with_comma ? ', ' : ''} LOCK=NONE"
end
|
28
29
30
|
# File 'lib/mysql_online_migrations.rb', line 28
def perform_migrations_online?
ActiveRecord::Base.mysql_online_migrations == true
end
|