mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Add db:structure:load_if_sql and db:schema:load_if_ruby back
Those tasks are deprecated though, just to maintain backwards compartibility and ask people to update their scripts. Fixes #40658.
This commit is contained in:
parent
90fa01b4c0
commit
18187a95dc
1 changed files with 16 additions and 0 deletions
|
@ -455,6 +455,14 @@ db_namespace = namespace :db do
|
||||||
ActiveRecord::Tasks::DatabaseTasks.load_schema_current(ActiveRecord::Base.schema_format, ENV["SCHEMA"])
|
ActiveRecord::Tasks::DatabaseTasks.load_schema_current(ActiveRecord::Base.schema_format, ENV["SCHEMA"])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
task load_if_ruby: ["db:create", :environment] do
|
||||||
|
ActiveSupport::Deprecation.warn(<<-MSG.squish)
|
||||||
|
Using `bin/rails db:schema:load_if_ruby` is deprecated and will be removed in Rails 6.2.
|
||||||
|
Configure the format using `config.active_record.schema_format = :ruby` to use `schema.rb` and run `bin/rails db:schema:load` instead.
|
||||||
|
MSG
|
||||||
|
db_namespace["schema:load"].invoke if ActiveRecord::Base.schema_format == :ruby
|
||||||
|
end
|
||||||
|
|
||||||
namespace :dump do
|
namespace :dump do
|
||||||
ActiveRecord::Tasks::DatabaseTasks.for_each(databases) do |name|
|
ActiveRecord::Tasks::DatabaseTasks.for_each(databases) do |name|
|
||||||
desc "Creates a database schema file (either db/schema.rb or db/structure.sql, depending on `config.active_record.schema_format`) for #{name} database"
|
desc "Creates a database schema file (either db/schema.rb or db/structure.sql, depending on `config.active_record.schema_format`) for #{name} database"
|
||||||
|
@ -529,6 +537,14 @@ db_namespace = namespace :db do
|
||||||
db_namespace["schema:load"].invoke
|
db_namespace["schema:load"].invoke
|
||||||
end
|
end
|
||||||
|
|
||||||
|
task load_if_sql: ["db:create", :environment] do
|
||||||
|
ActiveSupport::Deprecation.warn(<<-MSG.squish)
|
||||||
|
Using `bin/rails db:structure:load_if_sql` is deprecated and will be removed in Rails 6.2.
|
||||||
|
Configure the format using `config.active_record.schema_format = :sql` to use `structure.sql` and run `bin/rails db:schema:load` instead.
|
||||||
|
MSG
|
||||||
|
db_namespace["schema:load"].invoke if ActiveRecord::Base.schema_format == :sql
|
||||||
|
end
|
||||||
|
|
||||||
namespace :dump do
|
namespace :dump do
|
||||||
ActiveRecord::Tasks::DatabaseTasks.for_each(databases) do |name|
|
ActiveRecord::Tasks::DatabaseTasks.for_each(databases) do |name|
|
||||||
desc "Dumps the #{name} database structure to db/structure.sql. Specify another file with SCHEMA=db/my_structure.sql"
|
desc "Dumps the #{name} database structure to db/structure.sql. Specify another file with SCHEMA=db/my_structure.sql"
|
||||||
|
|
Loading…
Reference in a new issue