Thanks, I was able to delete the add_test_date fine. So I have:
db/migrate/001_create_products.rb
db/migrate/002_add_price.rb
db/migrate/add_test_data.rb
ran
rake db:migrate
only output was
(in C:rubyonrails/work/depot)
No change to the database, and the schema_info table has version 4 in
it.
here is the basic file i am trying to use:
class AddTestData < ActiveRecord::Migration
def self.up
Product.create(:title => 'Pragmatic Project Automation',
:description =>
%{<p>
<em>Pragmatic Project Automation</em> shows you how to improve
the
consistency and repeatability of your project’s procedures using
automation to reduce risk and errors.
Simply put, we’re going to put this thing called a computer to
work
for you doing the mundane (but important) project stuff. That
means
you’ll have more time and energy to do the really
exciting—and difficult—stuff, like writing quality code.
},
:image_url => ‘/images/auto.jpg’,
:price => 29.95)
end
def self.down
Product.delete_all
end
end
I don’t really know how or where it is supposed to get Product.create
from?
cheers
Jan P. wrote:
Hi Frank,
answers inline:
On 8/1/06, Frank M. [email protected] wrote:
Just going through ‘agile web development with rails’ 2nd ed.
I accidentally created an empty migration source file with the wrong
name,
ruby script/generate migration add_test_date
You might want to try ruby script/destroy migration add_test_date
and then straight after that created the one I wanted to use
ruby script/generate migration add_test_data
and populated the second one - when I ran
rake db:migrate
a few times it did not seem to update the table. I read something in the
book about creating empty migration files, but I thought if I created a
new one it should work.
Yes, I think so too. What exactly is it that is not working?
what should i do now? also - do i need the server running to perform
migrations?
No, that isn’t necessary.
cheers.
Cheers,
Jan
–