Changeset 1270 for plugins/merb_activerecord
- Timestamp:
- 01/10/08 13:48:32 (11 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/merb_activerecord/lib/merb/orms/active_record/tasks/databases.rb
r1247 r1270 1 1 task :environment do 2 Merb.environment = ( ENV['M erb.environment'] || Merb.environment ).to_sym2 Merb.environment = ( ENV['MERB_ENV'] || Merb.environment ).to_sym 3 3 end 4 4 … … 33 33 ActiveRecord::Base.connection.create_database(config[:database]) #, {:charset => @charset, :collation => @collation}) 34 34 ActiveRecord::Base.establish_connection(config) 35 p "MySQL #{config[:database]} database succesfully created"35 puts "MySQL #{config[:database]} database succesfully created" 36 36 rescue 37 37 $stderr.puts "Couldn't create database for #{config.inspect}" … … 45 45 end 46 46 else 47 p "#{config[:database]} already exists"47 puts "#{config[:database]} already exists" 48 48 end 49 49 else 50 p "This task only creates local databases. #{config[:database]} is on a remote host."50 puts "This task only creates local databases. #{config[:database]} is on a remote host." 51 51 end 52 52 end … … 55 55 task :drop => :environment do 56 56 config = ActiveRecord::Base.configurations[Merb.environment || :development] 57 p config58 57 case config[:adapter] 59 58 when 'mysql' … … 68 67 desc "Migrate the database through scripts in schema/migrations. Target specific version with VERSION=x" 69 68 task :migrate => :environment do 69 config = ActiveRecord::Base.configurations[Merb.environment || :development] 70 ActiveRecord::Base.establish_connection(config) 70 71 ActiveRecord::Migrator.migrate("schema/migrations/", ENV["VERSION"] ? ENV["VERSION"].to_i : nil) 71 72 Rake::Task["db:schema:dump"].invoke if ActiveRecord::Base.schema_format == :ruby
