Alex Rivera | Logout

Rails: I update migration file then run db:migrate, but my schema isn't updating

Asked 2009-09-13T01:21:05.733
24

I'm trying to add an extra field to one of my tables.

I've added the field in the migration file (under db\migrate), then ran 'rake db:migrate' which ran without troubles. My text editor even told me my schema.db file has been updated and needs to refresh.

The schema file does not contain my new field and any attempts to reference the field from my views fail miserably.

How do I do this? It is possible to update a table with an extra field via rails without having to totally drop and recreate the database again?

Edit
Report

1 Answer

0

Once u do rake db:migrate then again u cannot add column to that file.You have to generate a new migration file by using rails g migration add_columnname_to_tablename for adding that particular column and do rake db:migrate.That's it !!!

answered 2011-07-24T11:57:40.270

Your Answer