From schema.rb to structure sql
We use materialized views and proceadures in our apps, which are not reflected
on the schema.rb
To be able to use them in our tests and load the db structure without needing
to run migrations, it should be enough to set config.active_record.schema_format = :sql
and call rake db:structure:dump
, but this task has currently an invalid option for
postgres 9.5+
# rake db:structure:dump
# => pg_dump: invalid option -- i
# Try "pg_dump --help" for more information.
# rake aborted!
# Error dumping database
This has been fixed in the stable release with this commit: Remove deprecated pg_dump -i flag and backported to several rails versions. If you rather keep using the tagged version from a gem server instead of pointing to github stable you can add this through an initializer like this one (depending on your activere_record version)