Rake Migrations for Rails 1.1


#1

Hi all. I keep having the following error when I invoke the rake
db:migrate command for Rails 1.1 (Ruby 1.8.2 – Windows 2000)

** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
== Realtorex: migrating

– create()
rake aborted!
undefined method create' for #<ActiveRecord::ConnectionAdapters::MysqlAdapter:0x3472828> d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/migration.rb:271:insend’
d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/migration.rb:271:in
method_missing' d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/migration.rb:269:insay_with_time’
d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/migration.rb:255:in
measure' d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/migration.rb:255:insay_with_time’
d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/migration.rb:269:in
method_missing' ./db/migrate//001_realtorex.rb:3:inreal_up’
d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/migration.rb:209:in
send' d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/migration.rb:209:inmigrate’
d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/migration.rb:209:in
measure' d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/migration.rb:209:inmigrate’
d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/migration.rb:331:in
migrate' d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/migration.rb:326:ineach’
d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/migration.rb:326:in
migrate' d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/migration.rb:293:inup’
d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/migration.rb:284:in
migrate' d:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/tasks/databases.rake:4 d:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/tasks/databases.rake:3:incall’
d:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:232:in execute' d:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:232:ineach’
d:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:232:in execute' d:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:202:ininvoke’
d:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:195:in
synchronize' d:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:195:ininvoke’
d:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:1719:in run' d:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:1719:ineach’
d:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:1719:in run' d:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.0/bin/rake:7 d:/ruby/bin/rake:18:inload’


My migration file is the following:

class Realtorex < ActiveRecord::Migration
def self.up
create.table “pages”, :force => true do |t|
t.column “id”, :integer
t.column “name”, :string
t.column “title”, :string
t.column “body”, :text
t.column “body_html”, :text
t.column “user_id”, :integer
t.column “updated_at”, :datetime
t.column “created_at”, :datetime
end

create.table "users", :force => true do |t|
	t.column "id",				:integer
	t.column "login",			:string
	t.column "name",			:string
	t.column "hashed_password",	:string
	t.column "email",			:string
end

create.table "products", :force => true do |t|
	t.column "id",				:integer
	t.column "title",			:string
	t.column "description",		:text
	t.column "price",			:decimal
	t.column "availability",	:datetime
end

create.table "line_items", :force => true do |t|
	t.column "id",				:integer
	t.column "product_id",		:integer
	t.column "order_id",		:integer
	t.column "quantity",		:integer
	t.column "price",			:decimal
end

create.table "orders", :force => true do |t|
	t.column "id", 				:integer
	t.column "name",			:string
	t.column "email",			:string
	t.column "address",			:string
	t.column "city",			:string
	t.column "state",			:string
	t.column "zipcode",			:string
	t.column "pay_type",		:decimal
	t.column "fulfilled_at",	:datetime
end

end

def self.down
drop_table :pages
drop_table :users
drop_table :line_items
drop_table :orders
end
end

Any clues?


#2

You should call create_table rather than create.table, I think.

David


#3

David T. wrote:

You should call create_table rather than create.table, I think.

David

haha, you’re right. I can’t believe I missed that, silly me. Thanks
David!