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

Does not work with change_table :bulk=>true option #127

Open
dmeranda opened this issue Oct 12, 2013 · 2 comments
Open

Does not work with change_table :bulk=>true option #127

dmeranda opened this issue Oct 12, 2013 · 2 comments

Comments

@dmeranda
Copy link

All schema_plus column options are ignored inside a change_table if the :bulk option is set to true; at least with the MySQL connector which supports the bulk option. Consider the following migration statement:

change_table( "mytable" ) do |t|
  t.change "count", :integer, :index => true
  t.change "item_id", :integer, :foreign_key => { :references => ["items","id"] }
end

which will add the index and the foreign key (and its auto-generated index) as expected. However if you use the :bulk option,

change_table( "mytable", :bulk => true ) do |t|
...

then it operates as if the :index or :foreign_key options were not present.

@ronen
Copy link
Member

ronen commented Oct 22, 2013

@dmeranda thanks for the bug report. confirmed that i've reproduced it. looking into it...

ronen added a commit that referenced this issue Oct 23, 2013
…esses #127.

To do this, added some new features:
- remove_foreign_key takes table & column args (addresses #129), also :if_exists option
- remove_index takes :if_exists option

(still need to document these, and flesh out specs code coverage)
@ronen
Copy link
Member

ronen commented Oct 23, 2013

@dmeranda I've pushed a fix for this to master. (And fixes to other related problems with change_table as well.) If you could try it out from master and confirm that it works for you that'd be great.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants