I'm sorry, it doesn't throw me an error, it says Review(Table doesn't exist)
On Fri, Sep 26, 2008 at 8:58 AM, Jon Liu <[EMAIL PROTECTED]> wrote: > Craig, > > Yeah that sounds more feasible rather than migrating down...I can > definitely confirm VERSION=0 will drop the table though because when try to > load the structure in the console it throws me an error. > > What would be the syntax to just add a change(thus adding a new migration > then) > > I want to add t.intger :album_id. I'm assuming it's a command at the > command line that will product and 004 migration file? > > Jon > > > On Fri, Sep 26, 2008 at 8:43 AM, Craig White <[EMAIL PROTECTED]>wrote: > >> >> On Fri, 2008-09-26 at 08:31 -0700, Jon wrote: >> > the VERSION value at in rake db:migrate VERSION=[versionNumber] is the >> > migration number right? for instance lets say I have 3 models >> > generated in this respective order albums, users, and reviews. If I >> > do "rake db:migrate VERSION=0", it will delete the data and existence >> > of all three tables....if I do VERSION=1, it will delete the existance/ >> > data of users and reviews etc etc... >> > >> > So my problem is I rolled back to VERSION=0, added a column to Review >> > in the migration file, and migrated again. For some reason rails >> > didn't acknowledge the change and the table indecies are still the >> > same. >> > >> > So my before I rolled back to version 0: >> > >> > class CreateReviews < ActiveRecord::Migration >> > def self.up >> > create_table :reviews, :force => true do |t| >> > t.text :productReview >> > t.string :product >> > t.string :productCreator >> > >> > t.timestamps >> > end >> > >> > end >> > >> > def self.down >> > drop_table :reviews >> > end >> > end >> > >> > >> > I then put in a coloumn called album_id >> > >> > class CreateReviews < ActiveRecord::Migration >> > def self.up >> > create_table :reviews, :force => true do |t| >> > t.text :productReview >> > t.string :product >> > t.string :productCreator >> > t.integer :album_id >> > t.timestamps >> > end >> > >> > end >> > >> > def self.down >> > drop_table :reviews >> > end >> > end >> > >> > >> > Rand db:migrate and checked my structure in the console and it's still >> > the previous version without album_id.... >> > >> > Any thoughts? >> ---- >> The general idea is that when you want to change a model (i.e., add a >> column), that you created a new migration that adds the column to the >> table rather than migrate down and lose data. >> >> If however, you rake db:migrate VERSION=0, can you confirm indeed that >> the 'reviews' table is indeed dropped? >> >> Craig >> >> >> >> >> > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---