Rails 3.1.3 This is again a very basic question. Suppose I have implemented $ rails generate scaffold script video:references text:string it generated 20120128103756_create_scripts.rb But I want to change this model, so instead of redoing it like "rails destroy .... -> rails generate scaffold...", all I need to do is to edit the migration file above? Or do I need to reproduce ANOTHER migration file like above and add t.remove :text ??? I am a little confused because the migration file above has the time-stamp, which indicates the time of execution (rake db:migrate). So, does that mean the file above is useless unless I want to rollback? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
generate a new migratio where you specify what you want to do say: remove_column :table, :column add_column :table, :column, :type Regards! 2012/1/28 Soichi Ishida <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>> Rails 3.1.3 > > This is again a very basic question. > > Suppose I have implemented > > $ rails generate scaffold script video:references text:string > > it generated > > 20120128103756_create_scripts.rb > > But I want to change this model, so instead of redoing it like "rails > destroy .... -> rails generate scaffold...", all I need to do is to edit > the migration file above? > Or do I need to reproduce ANOTHER migration file like above and add > > t.remove :text > > ??? > > I am a little confused because the migration file above has the > time-stamp, which indicates the time of execution (rake db:migrate). > So, does that mean the file above is useless unless I want to rollback? > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Thanks for the clarification! soichi -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Sat, Jan 28, 2012 at 22:14, Soichi Ishida <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Suppose I have implemented > > $ rails generate scaffold script video:references text:string > > it generated > > 20120128103756_create_scripts.rb > > But I want to change this model, so instead of redoing it like "rails > destroy .... -> rails generate scaffold...", all I need to do is to edit > the migration file above?Depends. If you haven''t yet run rake db:migrate, you can just edit the migration, but you need to know what you''re doing if it''s complex. If you''ve already migrated, and you''ve used any new columns or tables you''ve added, then you must create another migration. If you''ve migrated but not used the new columns or tables, and it''s a migration that CAN be rolled back (not all can), you *can* roll it back (rake db:rollback), fix it, and re-migrate... but you must be *very* certain that your rollback won''t lose you any data. -Dave -- Dave Aronson: Available Cleared Ruby on Rails Freelancer (NoVa/DC/Remote) -- see www.DaveAronson.com, and blogs at www.Codosaur.us, www.Dare2XL.com, www.RecruitingRants.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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Thank you so much. I think it''s getting more fun to explore Rails! soichi -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.