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

Schema Dumper isn't honoring SchemaPlus.config.foreign_keys.auto_index=false setting. #101

Open
krobi64 opened this issue Apr 12, 2013 · 1 comment

Comments

@krobi64
Copy link

krobi64 commented Apr 12, 2013

Rails 3.1.12
SchemaPlus 0.4.1

My initializer:

SchemaPlus.setup do |config|
  config.foreign_keys.auto_create = false
  config.foreign_keys.auto_index = false
end

When I run rake db:schema:dump, I find the following in schema.rb:

create_table "Site", :primary_key => "siteID", :force => true do |t|
   t.integer "partnerID",                                                                                     :null => false
  t.string  "name",                                                                                          :null => false
  t.integer "intlDataCountryID",                                                          :default => 1,     :null => false
  t.index ["intlDataCountryID", "partnerID"], :name => "Site_IntlDataCountryID_FK"
  t.foreign_key ["intlDataCountryID"], "Intl_Data_Country", ["countryID"], :on_update => :restrict, :on_delete => :restrict, :name => "Site_IntlDataCountryID_FK"
end
@srpouyet
Copy link

srpouyet commented May 7, 2015

FYI: rake db:schema:load is still broken because of this in schema_plus 2.15pre :(
Postgres aborts because a FK referenced table hasn't been created yet.

As a workaround I disabled the foreign_keys auto_create like this:

SchemaPlus::ForeignKeys.setup do |config|
    config.auto_create = false
end

With this option set rake db:schema:load seems to work as normal.

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