Skip to content
This repository has been archived by the owner on May 13, 2022. It is now read-only.

Commit

Permalink
bring over command recorder remove_index :if_exists that was in schem…
Browse files Browse the repository at this point in the history
…a_plus_foreign_key

(or should it go in schema_plus_indexes?)
  • Loading branch information
ronen committed May 17, 2015
1 parent 7511aa1 commit 57d3cdb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/schema_plus/auto_foreign_keys.rb
@@ -1,5 +1,6 @@
require 'schema_plus/foreign_keys'

require_relative 'auto_foreign_keys/active_record/migration/command_recorder'
require_relative 'auto_foreign_keys/middleware/migration'
require_relative 'auto_foreign_keys/middleware/schema'

Expand Down
@@ -0,0 +1,14 @@
module SchemaAutoForeignKeys
module ActiveRecord
module Migration
module CommandRecorder

# overrides to add if_exists option
def invert_add_index(args)
table, columns, options = *args
[:remove_index, [table, (options||{}).merge(column: columns, if_exists: true)]]
end
end
end
end
end

0 comments on commit 57d3cdb

Please sign in to comment.