Sha256: 9b92c0ec8a0fb8e354a82694f3276aa6b461a720c80df8265802177dac6af853

Contents?: true

Size: 737 Bytes

Versions: 1

Compression:

Stored size: 737 Bytes

Contents

module RedhillonrailsCore
  module ActiveRecord
    module Migration
      module CommandRecorder
        def add_foreign_key(*args)
          record(:add_foreign_key, args)
        end

        def remove_foreign_key(*args)
          record(:remove_foreign_key, args)
        end

        def invert_add_foreign_key(args)
          from_table, to_table, add_options = *args
          add_options ||= {}

          if add_options[:name]
            options = {:name => add_options[:name]}
          elsif add_options[:column]
            options = {:column => add_options[:column]}
          else
            options = to_table
          end

          [:remove_foreign_key, [from_table, options]]
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aspgems-redhillonrails_core-2.0.0.beta4 lib/redhillonrails_core/active_record/migration/command_recorder.rb