Rails deprecates `db:structure:load` and `db:structure:dump` tasks

Rails has deprecated db:structure:load and db:structure:dump tasks.


config.active_record.schema_format controls the format for dumping the database schema to a file. :ruby(default) and :sql are the valid options for this config.

Running rails db:schema:{dump,load} will dump or load db/schema.rb file and rails db:structure:{dump,load} will dump or load db/structure.sql file, regardless of value specified for config.active_record.schema_format.


Both the commands, rails db:schema:{dump,load} and rails db:structure:{dump,load} will run rails db:schema:{dump,load} depending on the value specified for config.active_record.schema_format.

So running, rails db:schema:dump or rails db:structure:dump will dump db/schema.rb file.

If we specify :sql as the value for config.active_record.schema_format, running rails db:schema:dump or rails db:structure:dump will dump db/stucture.sql file.

Running rails db:structure:{dump,load} will result in a deprecation warning, as these commands will be removed in Rails 6.2:

DEPRECATION WARNING: Using `bin/rails db:structure:load` is deprecated and will be removed in Rails 6.2.
Configure the format using `config.active_record.schema_format = :sql` to use `structure.sql`
run `bin/rails db:schema:load` instead

Note: config.active_support.deprecation = :stderr has to be set for above deprecation message to show up.

Need help on your Ruby on Rails or React project?

Join Our Newsletter