Sha256: 902452033a90da12c6b9c7abd2ba51d63236df1e151ca56e920297b3ab07b201

Contents?: true

Size: 489 Bytes

Versions: 18

Compression:

Stored size: 489 Bytes

Contents

module SchemaPlus::ForeignKeys
  module Middleware

    module Mysql
      module Migration
        module DropTable

          def around(env)
            if (env.options[:force] == :cascade)
              env.connection.reverse_foreign_keys(env.table_name).each do |foreign_key|
                env.connection.remove_foreign_key(foreign_key.from_table, name: foreign_key.name)
              end
            end
            yield env
          end
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
schema_plus_foreign_keys-0.1.8 lib/schema_plus/foreign_keys/middleware/mysql.rb
schema_plus_foreign_keys-0.1.7 lib/schema_plus/foreign_keys/middleware/mysql.rb
schema_plus_foreign_keys-0.1.6 lib/schema_plus/foreign_keys/middleware/mysql.rb
schema_plus_foreign_keys-0.1.5 lib/schema_plus/foreign_keys/middleware/mysql.rb
schema_plus_foreign_keys-0.1.4 lib/schema_plus/foreign_keys/middleware/mysql.rb
schema_plus_foreign_keys-0.1.3 lib/schema_plus/foreign_keys/middleware/mysql.rb
schema_plus_foreign_keys-0.1.2 lib/schema_plus/foreign_keys/middleware/mysql.rb
schema_plus_foreign_keys-0.1.1 lib/schema_plus/foreign_keys/middleware/mysql.rb
schema_plus_foreign_keys-0.1.0 lib/schema_plus/foreign_keys/middleware/mysql.rb
schema_plus-2.0.0.pre15 lib/schema_plus/foreign_keys/middleware/mysql.rb
schema_plus-2.0.0.pre14 lib/schema_plus/foreign_keys/middleware/mysql.rb
schema_plus-2.0.0.pre13 lib/schema_plus/foreign_keys/middleware/mysql.rb
schema_plus-2.0.0.pre12 lib/schema_plus/foreign_keys/middleware/mysql.rb
schema_plus-2.0.0.pre11 lib/schema_plus/foreign_keys/middleware/mysql.rb
schema_plus-2.0.0.pre10 lib/schema_plus/foreign_keys/middleware/mysql.rb
schema_plus-2.0.0.pre9 lib/schema_plus/foreign_keys/middleware/mysql.rb
schema_plus-2.0.0.pre8 lib/schema_plus/foreign_keys/middleware/mysql.rb
schema_plus-2.0.0.pre7 lib/schema_plus/foreign_keys/middleware/mysql.rb