Module: ActiveRecord::Migration::Compatibility::FourTwoShared
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
56 57 58 59 |
# File 'lib/active_record/migration/compatibility.rb', line 56 def add_reference(*, **) [:index] ||= false super end |
#add_timestamps(**options) ⇒ Object
62 63 64 65 |
# File 'lib/active_record/migration/compatibility.rb', line 62 def (*, **) [:null] = true if [:null].nil? super end |
#change_table(table_name, options = {}) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/active_record/migration/compatibility.rb', line 43 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
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/active_record/migration/compatibility.rb', line 30 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
67 68 69 70 71 72 73 74 75 76 |
# File 'lib/active_record/migration/compatibility.rb', line 67 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 |
#remove_index(table_name, options = {}) ⇒ Object
78 79 80 81 82 |
# File 'lib/active_record/migration/compatibility.rb', line 78 def remove_index(table_name, = {}) = { column: } unless .is_a?(Hash) [:name] = index_name_for_remove(table_name, ) super(table_name, ) end |