If using the this option in config/application.rb:
config.active_record.schema_format = :sql
then when you do:
rake db:migrate
it only dumps the db/structure.sql. I know it isn’t using the db/schema.rb since it is using the :sql option, but how can you make rake db:migrate generate db/schema.rb also?
We need that because RubyMine 4.5 and IntelliJ IDea 11 use db/schema.rb for autocompletion of columns.
To generate/update
db/schema.rbeven if using the:sqloption, you can put this in yourRakefile:That should be fine for IDea and RubyMine.
For others that just want the file for reference, you might want to rename it to something else like
db/schema.rb.backupso it won’t be confusing. To do that:(Note: Using
../in paths inRakefilebecause__FILE__evaluates to a path that ends in/Rakefile.)