Sha256: e3efc6d829db3cfb9a2fb040878cffd00b65d2c0cdd28bd6e17ba1d68d4725f4

Contents?: true

Size: 989 Bytes

Versions: 5

Compression:

Stored size: 989 Bytes

Contents

namespace :db do
  desc "Migrate schema to version 0 and back up again. WARNING: Destroys all data in tables!!"
  task :remigrate => :environment do
    require 'highline/import'
    if ENV['OVERWRITE'].to_s.downcase == 'true' or
      agree("This task will destroy any data in the database. Are you sure you want to \ncontinue? [yn] ")
      
      # Migrate downward
      ActiveRecord::Migrator.migrate("#{RADIANT_ROOT}/db/migrate/", 0)
    
      # Migrate upward 
      Rake::Task["db:migrate"].invoke
      
      # Dump the schema
      Rake::Task["db:schema:dump"].invoke
    else
      say "Task cancelled."
      exit
    end
  end
  
  desc "Bootstrap your database for Radiant."
  task :bootstrap => :remigrate do
    require 'radiant/setup'
    Radiant::Setup.bootstrap(
      :admin_name => ENV['ADMIN_NAME'],
      :admin_username => ENV['ADMIN_USERNAME'],
      :admin_password => ENV['ADMIN_PASSWORD'],
      :database_template => ENV['DATABASE_TEMPLATE']
    )
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
radiant-0.6.0 lib/tasks/database.rake
radiant-0.6.1 lib/tasks/database.rake
radiant-0.6.2 lib/tasks/database.rake
radiant-0.6.3 lib/tasks/database.rake
radiant-0.6.4 lib/tasks/database.rake