SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 139 | Next

Kevin Marshall, Chad Pytel, and Jon Yurek

"Pro Active Record: Databases with Ruby and Rails"

Lucky for you, we??™re going to get you started on that task.
The following script assumes that you will be storing your database configuration details
in a YAML file called database.yml. For simplicity, the following script, the YAML file, and your
migrations are assumed to all be located in the same directory.
require 'rubygems'
require_gem 'activerecord'
if ARGV[0] =~ /VERSION=\d+/
version = ARGV[0].split('=')[1].to_i
else
version = nil
end
@logger = Logger.new $stderr
ActiveRecord::Base.logger = @logger
ActiveRecord::Base.colorize_logging = false
@config = YAML.load_file(File.join(File.dirname(__FILE__), 'database.yml'))
ActiveRecord::Base.establish_connection(@config["development"])
ActiveRecord::Migrator.migrate("", version)
Assuming you place the preceding script in a file called migrate.rb, you can run your
sequentially numbered migrations with the command ruby migrate.rb.
?– Note This script does not generate the migration files. You??™ll still need to create and populate the files by
hand (or write another script to generate them).


Pages:
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6