Hi, I am trying to learn Rails by working with different packages (ActiveRecord, ActiveSupport) without rails gem.
I can't figure out how to create a database with three classes, though. Here's my rakefile:
require 'rubygems'
require 'activerecord'
require 'yaml'
task :default => :migrate
desc "Migrate the database through scripts in db/migrate. Target specific version with VERSION=x"
task :migrate => :environment do
ActiveRecord::Migrator.migrate('db/migrate', ENV["VERSION"] ? ENV["VERSION"].to_i : nil )
end
task :environment do
ActiveRecord::Base.establish_connection(YAML::load(File.open('database.yml')))
ActiveRecord::Base.logger = Logger.new(File.open('database.log', 'a'))
end
And I have three files:
001_create_appearances.rb 001_create_movies.rb 001_create_actors.rb
Which I have all run successfully in the past, each one just inherits from ActiveRecord::Migration and does self.up/self.down.
I have, however, problem, that when I run rake, it returns "Multiple migrations have the version number 1". Should I pack all the migrations into one file, like 001_create_database.rb?
Is there a manual somewhere that describes how these versions work?
I tried reading source of migrator.rb but couldn't find where up_without_benchmarks/down_without_benchmarks where located.