Question

In earlier versions of Rails, the structure.sql file generated by db:structure:dump was prefixed by the environment name, but this prefix appears to have been dropped in recent versions (I'm using 3.2.13). The file is now named structure.sql, irrespective of the environment from which it was generated. Does anyone know the reason for this? I have not found any documentation related to this change.

Looking at the source code (in lib/active_record/railties/databases.rake), it appears that you can still customize the structure filename through the DB_STRUCTURE environment variable, but I would like to know why the default was changed.

Was it helpful?

Solution

Looks like the commit in question is 15fb430. The commit message gives the reason:

schema_format :sql should behave like schema_format :ruby

This commit adds a db:structure:load task that is run instead of db:schema:load when schema_format is set to :sql. This patch also removes the prefixing of the structure.sql files to mimic the use of a single schema.rb file. The patch originates from github issue #715.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top