Charles Rajesh
2007-Aug-29 07:48 UTC
Re: How to update DB:migration file after adding a column
Darius Azimi wrote:> Lets say you already have an orders table in your db. > > Here''s a migration that adds an e_mail column to the orders table. > --------------- > > class AddEmailColumnToOrders < ActiveRecord::Migration > > def self.up > add_column :orders, :e_mail, :string > end > > def self.down > remove_column :orders, :e_mail > end > > end > > ---------------- > > I would use the migration instead of manipulating the mysql using either > a front-end or a command line. With migration you have a way to > roll-back and also can view all the changes that have been done on the > db side. > > All the best. > > do some googling to see a few tutorials. > > The example above is from the agile web development book.Thanx a lot guys! it worked great.. will change my mode of approach in working with DB hereafter.. really this migration feature eases the work. again, thanx a lot!! regards, - Charles. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---