Class: ActiveRecord::Migration::Compatibility::V4_2
- Defined in:
- activerecord/lib/active_record/migration/compatibility.rb
Defined Under Namespace
Modules: TableDefinition
Instance Method Summary collapse
- #add_reference(**options) ⇒ Object (also: #add_belongs_to)
- #add_timestamps(_, **options) ⇒ Object
- #change_table(table_name, options = {}) ⇒ Object
- #create_table(table_name, options = {}) ⇒ Object
- #index_exists?(table_name, column_name, options = {}) ⇒ Boolean
- #remove_index(table_name, options = {}) ⇒ Object
Instance Method Details
#add_reference(**options) ⇒ Object Also known as: add_belongs_to
120 121 122 123 |
# File 'activerecord/lib/active_record/migration/compatibility.rb', line 120 def add_reference(*, **) [:index] ||= false super end |
#add_timestamps(_, **options) ⇒ Object
126 127 128 129 |
# File 'activerecord/lib/active_record/migration/compatibility.rb', line 126 def (_, **) [:null] = true if [:null].nil? super end |
#change_table(table_name, options = {}) ⇒ Object
107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'activerecord/lib/active_record/migration/compatibility.rb', line 107 def change_table(table_name, = {}) if block_given? super(table_name, ) do |t| class << t prepend TableDefinition end yield t end else super end end |
#create_table(table_name, options = {}) ⇒ Object
94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'activerecord/lib/active_record/migration/compatibility.rb', line 94 def create_table(table_name, = {}) if block_given? super(table_name, ) do |t| class << t prepend TableDefinition end yield t end else super end end |
#index_exists?(table_name, column_name, options = {}) ⇒ Boolean
131 132 133 134 135 136 137 138 139 140 |
# File 'activerecord/lib/active_record/migration/compatibility.rb', line 131 def index_exists?(table_name, column_name, = {}) column_names = Array(column_name).map(&:to_s) [:name] = if [:name].present? [:name].to_s else index_name(table_name, column: column_names) end super end |