diff options
-rw-r--r-- | activerecord/lib/active_record/railties/databases.rake | 18 | ||||
-rw-r--r-- | railties/lib/rails/tasks/misc.rake | 7 |
2 files changed, 9 insertions, 16 deletions
diff --git a/activerecord/lib/active_record/railties/databases.rake b/activerecord/lib/active_record/railties/databases.rake index f5991e893c..6bb0c39b79 100644 --- a/activerecord/lib/active_record/railties/databases.rake +++ b/activerecord/lib/active_record/railties/databases.rake @@ -20,7 +20,7 @@ db_namespace = namespace :db do end desc 'Create the database from config/database.yml for the current Rails.env (use db:create:all to create all dbs in the config)' - task :create => [:load_config, :rails_env] do + task :create => [:load_config] do ActiveRecord::Tasks::DatabaseTasks.create_current end @@ -31,7 +31,7 @@ db_namespace = namespace :db do end desc 'Drops the database for the current Rails.env (use db:drop:all to drop all databases)' - task :drop => [:load_config, :rails_env] do + task :drop => [:load_config] do ActiveRecord::Tasks::DatabaseTasks.drop_current end @@ -88,7 +88,7 @@ db_namespace = namespace :db do end desc 'Display status of migrations' - task :status => [:environment, :load_config, :rails_env] do + task :status => [:environment, :load_config] do config = ActiveRecord::Base.configurations[Rails.env] ActiveRecord::Base.establish_connection(config) unless ActiveRecord::Base.connection.table_exists?(ActiveRecord::Migrator.schema_migrations_table_name) @@ -142,12 +142,12 @@ db_namespace = namespace :db do end # desc "Retrieves the charset for the current environment's database" - task :charset => [:environment, :load_config, :rails_env] do + task :charset => [:environment, :load_config] do puts ActiveRecord::Tasks::DatabaseTasks.charset_current end # desc "Retrieves the collation for the current environment's database" - task :collation => [:environment, :load_config, :rails_env] do + task :collation => [:environment, :load_config] do begin puts ActiveRecord::Tasks::DatabaseTasks.collation_current rescue NoMethodError @@ -184,7 +184,7 @@ db_namespace = namespace :db do namespace :fixtures do desc "Load fixtures into the current environment's database. Load specific fixtures using FIXTURES=x,y. Load from subdirectory in test/fixtures using FIXTURES_DIR=z. Specify an alternative path (eg. spec/fixtures) using FIXTURES_PATH=spec/fixtures." - task :load => [:environment, :load_config, :rails_env] do + task :load => [:environment, :load_config] do require 'active_record/fixtures' ActiveRecord::Base.establish_connection(Rails.env) @@ -222,7 +222,7 @@ db_namespace = namespace :db do namespace :schema do desc 'Create a db/schema.rb file that can be portably used against any DB supported by AR' - task :dump => [:environment, :load_config, :rails_env] do + task :dump => [:environment, :load_config] do require 'active_record/schema_dumper' filename = ENV['SCHEMA'] || "#{Rails.root}/db/schema.rb" File.open(filename, "w:utf-8") do |file| @@ -248,7 +248,7 @@ db_namespace = namespace :db do namespace :cache do desc 'Create a db/schema_cache.dump file.' - task :dump => [:environment, :load_config, :rails_env] do + task :dump => [:environment, :load_config] do con = ActiveRecord::Base.connection filename = File.join(Rails.application.config.paths["db"].first, "schema_cache.dump") @@ -277,7 +277,7 @@ db_namespace = namespace :db do end desc 'Dump the database structure to db/structure.sql. Specify another file with DB_STRUCTURE=db/my_structure.sql' - task :dump => [:environment, :load_config, :rails_env] do + task :dump => [:environment, :load_config] do abcs = ActiveRecord::Base.configurations filename = ENV['DB_STRUCTURE'] || File.join(Rails.root, "db", "structure.sql") case abcs[Rails.env]['adapter'] diff --git a/railties/lib/rails/tasks/misc.rake b/railties/lib/rails/tasks/misc.rake index 0dcca36d8b..0a9b9ff4ff 100644 --- a/railties/lib/rails/tasks/misc.rake +++ b/railties/lib/rails/tasks/misc.rake @@ -1,10 +1,3 @@ -task :rails_env do - # TODO Do we really need this? - unless defined? RAILS_ENV - RAILS_ENV = ENV['RAILS_ENV'] ||= 'development' - end -end - desc 'Generate a cryptographically secure secret key (this is typically used to generate a secret for cookie sessions).' task :secret do require 'securerandom' |