Topic: Rake Migrate Not Working Correctly

So, I have a Sqlite3 database setup and whenever I issue the command Rake Migrate, nothing updates in my database file.
There is no error or anything in the console; simply, my database just doesn't update.
I hope someone can help me out with this. Thanks.

-Lake.

Re: Rake Migrate Not Working Correctly

Have you configured the database.yml file properly? I would expect there to be an error if it isn't configured right though. Try running the migration with the trace option:

rake --trace db:migrate

Railscasts - Free Ruby on Rails Screencasts

Re: Rake Migrate Not Working Correctly

I have tried that, here are the results:

** 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 Here is my Database.yml configuration:

development:
  adapter: sqlite3
  dbfile: db/dev.db

Last edited by ldenman (2006-12-09 14:49:09)

Re: Rake Migrate Not Working Correctly

Hmm, I haven't used SQLite, so I probably can't help you further. I did find this (old) thread though:

SQLite and Rails

In that case I think he just needed to update the sqlite3-ruby gem

Railscasts - Free Ruby on Rails Screencasts

Re: Rake Migrate Not Working Correctly

maybe we can troubleshoot it out.
When I initially rake db:migrate, tables are added as expected.
However, after that first initial migration, I can no longer make changes to the database via migrations.

Re: Rake Migrate Not Working Correctly

that's weird, so some migration files are working, but some aren't? If you don't mind losing the data in the database, try setting it to an older version and migrating up again.

rake db:migrate VERSION=0
rake db:migrate

If that doesn't fix it, can you post your migration files? If there's not too many.

Railscasts - Free Ruby on Rails Screencasts

Re: Rake Migrate Not Working Correctly

actually, I just realized what was going on.
I thought that I could just add:
t.column :body, :text  to my 001_create_blogs.rb file.
I thought it would just update my schema.
After reading something DFischer sent me, I figured out you have to generate an entirely new migration such as:
./script/generate migration add_body_to_blogs
then to that 002.rb file:
add_column "blogs", "body", :text


phew. Sorry for the confusion Ryan and thanks for your help.

Last edited by ldenman (2006-12-09 17:38:56)