Rake db:migrate - doing nothing to the database


#1

when I do the rake db:migrate, with a migration file that is supposed to
add 3 records to the database, it ends up doing nothing to the database
at all. here is what happens when I type in: “rake db:migrate --trace”

(in C:/InstantRails/rails_apps/work/depot)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
** Invoke db:schema:dump (first_time)
** Invoke environment
** Execute db:schema:dump

And then it’s back to the command prompt. Any suggestions as to why it
is doing nothing?


#2

Alright, I made a new migration file, with the same code, and it works
now. So my new question is this:

If I make a migration file, and then do a rake db:migrate, and then I
want to change one of the migration files, how can I do that?

It seems that once I’ve done the rake db:migrate, it does not recognize
any changes to the migration files that are there.


#3

In that case, your database was already at the highest schema. When you
added a new migration, db:migrate saw a migration with a higher version
number and processed it (Migrate creates a schema_info table in your
DB).
Read up on migrations here:

http://api.rubyonrails.org/classes/ActiveRecord/Migration.html

Jason


#4

yeah you can either

  1. change migrations, then migrate ‘down’ then up
  2. add a new migration that changes the schema (better – you can
    rename tables, etc.)

On Feb 16, 12:56 pm, “Josh P.” removed_email_address@domain.invalid