Module: SchemaMonkey::ActiveRecord::ConnectionAdapters::SchemaStatements::Column
- Defined in:
- lib/schema_monkey/active_record/connection_adapters/schema_statements.rb
Overview
The hooks below here are grouped into modules. Different connection adapters define this methods in different places, so each will include the hooks into the appropriate class
Class Method Summary collapse
Instance Method Summary collapse
- #add_column_with_schema_monkey(table_name, name, type, options = {}) ⇒ Object
- #change_column_with_schema_monkey(table_name, name, type, options = {}) ⇒ Object
Class Method Details
.included(base) ⇒ Object
33 34 35 36 37 38 |
# File 'lib/schema_monkey/active_record/connection_adapters/schema_statements.rb', line 33 def self.included(base) base.class_eval do alias_method_chain :add_column, :schema_monkey alias_method_chain :change_column, :schema_monkey end end |
Instance Method Details
#add_column_with_schema_monkey(table_name, name, type, options = {}) ⇒ Object
40 41 42 43 44 |
# File 'lib/schema_monkey/active_record/connection_adapters/schema_statements.rb', line 40 def add_column_with_schema_monkey(table_name, name, type, = {}) Middleware::Migration::Column.start caller: self, operation: :add, table_name: table_name, column_name: name, type: type, options: .deep_dup do |env| add_column_without_schema_monkey env.table_name, env.column_name, env.type, env. end end |
#change_column_with_schema_monkey(table_name, name, type, options = {}) ⇒ Object
46 47 48 49 50 |
# File 'lib/schema_monkey/active_record/connection_adapters/schema_statements.rb', line 46 def change_column_with_schema_monkey(table_name, name, type, = {}) Middleware::Migration::Column.start caller: self, operation: :change, table_name: table_name, column_name: name, type: type, options: .deep_dup do |env| change_column_without_schema_monkey env.table_name, env.column_name, env.type, env. end end |