aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/railties/databases.rake
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/railties/databases.rake')
-rw-r--r--activerecord/lib/active_record/railties/databases.rake48
1 files changed, 24 insertions, 24 deletions
diff --git a/activerecord/lib/active_record/railties/databases.rake b/activerecord/lib/active_record/railties/databases.rake
index 952f2a3070..006e64b115 100644
--- a/activerecord/lib/active_record/railties/databases.rake
+++ b/activerecord/lib/active_record/railties/databases.rake
@@ -5,7 +5,7 @@ namespace :db do
end
namespace :create do
- desc 'Create all the local databases defined in config/database.yml'
+ # desc 'Create all the local databases defined in config/database.yml'
task :all => :load_config do
ActiveRecord::Base.configurations.each_value do |config|
# Skip entries that don't have a database key, such as the first entry here:
@@ -26,7 +26,7 @@ namespace :db do
end
end
- desc 'Create the database defined in config/database.yml for the current Rails.env - also makes test database if in development mode'
+ 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 do
# Make the test database at the same time as the development one, if it exists
if Rails.env.development? && ActiveRecord::Base.configurations['test']
@@ -100,7 +100,7 @@ namespace :db do
end
namespace :drop do
- desc 'Drops all the local databases defined in config/database.yml'
+ # desc 'Drops all the local databases defined in config/database.yml'
task :all => :load_config do
ActiveRecord::Base.configurations.each_value do |config|
# Skip entries that don't have a database key
@@ -115,7 +115,7 @@ namespace :db do
end
end
- desc 'Drops the database for the current Rails.env'
+ desc 'Drops the database for the current Rails.env (use db:drop:all to drop all databases)'
task :drop => :load_config do
config = ActiveRecord::Base.configurations[Rails.env || 'development']
begin
@@ -134,7 +134,7 @@ namespace :db do
end
- desc "Migrate the database through scripts in db/migrate and update db/schema.rb by invoking db:schema:dump. Target specific version with VERSION=x. Turn off output with VERBOSE=false."
+ desc "Migrate the database (options: VERSION=x, VERBOSE=false)."
task :migrate => :environment do
ActiveRecord::Migration.verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true
ActiveRecord::Migrator.migrate("db/migrate/", ENV["VERSION"] ? ENV["VERSION"].to_i : nil)
@@ -142,7 +142,7 @@ namespace :db do
end
namespace :migrate do
- desc 'Rollbacks the database one migration and re migrate up. If you want to rollback more than one step, define STEP=x. Target specific version with VERSION=x.'
+ # desc 'Rollbacks the database one migration and re migrate up (options: STEP=x, VERSION=x).'
task :redo => :environment do
if ENV["VERSION"]
Rake::Task["db:migrate:down"].invoke
@@ -153,10 +153,10 @@ namespace :db do
end
end
- desc 'Resets your database using your migrations for the current environment'
+ # desc 'Resets your database using your migrations for the current environment'
task :reset => ["db:drop", "db:create", "db:migrate"]
- desc 'Runs the "up" for a given migration VERSION.'
+ # desc 'Runs the "up" for a given migration VERSION.'
task :up => :environment do
version = ENV["VERSION"] ? ENV["VERSION"].to_i : nil
raise "VERSION is required" unless version
@@ -164,7 +164,7 @@ namespace :db do
Rake::Task["db:schema:dump"].invoke if ActiveRecord::Base.schema_format == :ruby
end
- desc 'Runs the "down" for a given migration VERSION.'
+ # desc 'Runs the "down" for a given migration VERSION.'
task :down => :environment do
version = ENV["VERSION"] ? ENV["VERSION"].to_i : nil
raise "VERSION is required" unless version
@@ -173,24 +173,24 @@ namespace :db do
end
end
- desc 'Rolls the schema back to the previous version. Specify the number of steps with STEP=n'
+ desc 'Rolls the schema back to the previous version (specify steps w/ STEP=n).'
task :rollback => :environment do
step = ENV['STEP'] ? ENV['STEP'].to_i : 1
ActiveRecord::Migrator.rollback('db/migrate/', step)
Rake::Task["db:schema:dump"].invoke if ActiveRecord::Base.schema_format == :ruby
end
- desc 'Pushes the schema to the next version. Specify the number of steps with STEP=n'
+ # desc 'Pushes the schema to the next version (specify steps w/ STEP=n).'
task :forward => :environment do
step = ENV['STEP'] ? ENV['STEP'].to_i : 1
ActiveRecord::Migrator.forward('db/migrate/', step)
Rake::Task["db:schema:dump"].invoke if ActiveRecord::Base.schema_format == :ruby
end
- desc 'Drops and recreates the database from db/schema.rb for the current environment and loads the seeds.'
+ # desc 'Drops and recreates the database from db/schema.rb for the current environment and loads the seeds.'
task :reset => [ 'db:drop', 'db:setup' ]
- desc "Retrieves the charset for the current environment's database"
+ # desc "Retrieves the charset for the current environment's database"
task :charset => :environment do
config = ActiveRecord::Base.configurations[Rails.env || 'development']
case config['adapter']
@@ -208,7 +208,7 @@ namespace :db do
end
end
- desc "Retrieves the collation for the current environment's database"
+ # desc "Retrieves the collation for the current environment's database"
task :collation => :environment do
config = ActiveRecord::Base.configurations[Rails.env || 'development']
case config['adapter']
@@ -225,7 +225,7 @@ namespace :db do
puts "Current version: #{ActiveRecord::Migrator.current_version}"
end
- desc "Raises an error if there are pending migrations"
+ # desc "Raises an error if there are pending migrations"
task :abort_if_pending_migrations => :environment do
if defined? ActiveRecord
pending_migrations = ActiveRecord::Migrator.new(:up, 'db/migrate').pending_migrations
@@ -240,7 +240,7 @@ namespace :db do
end
end
- desc 'Create the database, load the schema, and initialize with the seed data'
+ desc 'Create the database, load the schema, and initialize with the seed data (use db:reset to also drop the db first)'
task :setup => [ 'db:create', 'db:schema:load', 'db:seed' ]
desc 'Load the seed data from db/seeds.rb'
@@ -263,7 +263,7 @@ namespace :db do
end
end
- desc "Search for a fixture given a LABEL or ID. Specify an alternative path (eg. spec/fixtures) using FIXTURES_PATH=spec/fixtures."
+ # desc "Search for a fixture given a LABEL or ID. Specify an alternative path (eg. spec/fixtures) using FIXTURES_PATH=spec/fixtures."
task :identify => :environment do
require 'active_record/fixtures'
@@ -347,17 +347,17 @@ namespace :db do
end
namespace :test do
- desc "Recreate the test database from the current schema.rb"
+ # desc "Recreate the test database from the current schema.rb"
task :load => 'db:test:purge' do
ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations['test'])
ActiveRecord::Schema.verbose = false
Rake::Task["db:schema:load"].invoke
end
- desc "Recreate the test database from the current environment's database schema"
+ # desc "Recreate the test database from the current environment's database schema"
task :clone => %w(db:schema:dump db:test:load)
- desc "Recreate the test databases from the development structure"
+ # desc "Recreate the test databases from the development structure"
task :clone_structure => [ "db:structure:dump", "db:test:purge" ] do
abcs = ActiveRecord::Base.configurations
case abcs["test"]["adapter"]
@@ -391,7 +391,7 @@ namespace :db do
end
end
- desc "Empty the test database"
+ # desc "Empty the test database"
task :purge => :environment do
abcs = ActiveRecord::Base.configurations
case abcs["test"]["adapter"]
@@ -422,7 +422,7 @@ namespace :db do
end
end
- desc 'Check for pending migrations and load the test schema'
+ # desc 'Check for pending migrations and load the test schema'
task :prepare => 'db:abort_if_pending_migrations' do
if defined?(ActiveRecord) && !ActiveRecord::Base.configurations.blank?
Rake::Task[{ :sql => "db:test:clone_structure", :ruby => "db:test:load" }[ActiveRecord::Base.schema_format]].invoke
@@ -431,7 +431,7 @@ namespace :db do
end
namespace :sessions do
- desc "Creates a sessions migration for use with ActiveRecord::SessionStore"
+ # desc "Creates a sessions migration for use with ActiveRecord::SessionStore"
task :create => :environment do
raise "Task unavailable to this database (no migration support)" unless ActiveRecord::Base.connection.supports_migrations?
require 'rails/generators'
@@ -440,7 +440,7 @@ namespace :db do
Rails::Generators::SessionMigrationGenerator.start [ ENV["MIGRATION"] || "add_sessions_table" ]
end
- desc "Clear the sessions table"
+ # desc "Clear the sessions table"
task :clear => :environment do
ActiveRecord::Base.connection.execute "DELETE FROM #{session_table_name}"
end