Reputation: 3008
I'm using a postgres feature that rails schema.rb file doesn't support so I've set config.active_record.schema_format = :sql
to ensure that all aspects of my database schema are recorded. However, when I set this option rails seems to stop updating the schema.rb file.
Since schema.rb is far far easier to read and I really only need structure.sql to capture the array_to_string function needed to generate a certain fulltext index I'd like to have migrations automatically update schema.rb as well as structure.sql.
Is there any way to get rails to update both when I run db:migrate without (as I've been doing) changing the config option by hand and then rerunning db:migrate?
Upvotes: 1
Views: 1076
Reputation: 3008
Ohh, I'm being an idiot. There are rake tasks db:schema:dump and db:structure:dump. All I have to do is to create a new task that has dependencies on db:migrate and both db:structure:dump db:schema:dump or just run them both on the command line.
Upvotes: 1