I did something wrong during first migration. I would like to drop the table and call migration again to re-create the table. but don''t know the appropriate way to do it. any idea? -- 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 -~----------~----~----~----~------~----~------~--~---
Yan wrote:> I did something wrong during first migration. I would like to drop the > table and call migration again to re-create the table. but don''t know > the appropriate way to do it.Get into the database (maybe mysql -u root), drop the database, and recreate it. -- Phlip http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
mcintyre.tim-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jan-29 20:26 UTC
Re: how to drop table and recreate the table using migrate
rake db:migrate VERSION=0 rake db:migrate good luck! Tim On Jan 29, 12:07 pm, Yan <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I did something wrong during first migration. I would like to drop the > table and call migration again to re-create the table. but don''t know > the appropriate way to do it. > > any idea? > > -- > Posted viahttp://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 -~----------~----~----~----~------~----~------~--~---
unknown wrote:> rake db:migrate VERSION=0 > rake db:migrate > > good luck! > TimIt doesn''t work. I don''t know why. It seems I have to go to mysql to drop the entire database. -- 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 -~----------~----~----~----~------~----~------~--~---
Jim Lindley
2007-Jan-29 20:40 UTC
Re: how to drop table and recreate the table using migrate
> > rake db:migrate VERSION=0 > > rake db:migrate > > > > It doesn''t work. I don''t know why. It seems I have to go to mysql to > drop the entire database. >If something unexpected happens, the rake migrate task will leave it up to you to clean up manually. It''s not smart enough to recover from the many different things that can go wrong. You can run your migrations first as rake db:migrate --dry-run --trace That''ll catch some possible errors before running the migration for real. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> > rake db:migrate VERSION=0 > > rake db:migrateYan wrote:> It doesn''t work.It probably requires effective self.down methods. I suspect that _some_ people slack off on those. Not _me_, of course! -- Phlip http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Jim Lindley wrote:>> > rake db:migrate VERSION=0 >> > rake db:migrate >> > >> >> It doesn''t work. I don''t know why. It seems I have to go to mysql to >> drop the entire database. >> > > If something unexpected happens, the rake migrate task will leave it > up to you to clean up manually. It''s not smart enough to recover from > the many different things that can go wrong. > > You can run your migrations first as > > rake db:migrate --dry-run --trace > > That''ll catch some possible errors before running the migration for > real.Below is waht I got: ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute (dry run) environment ** Execute (dry run) db:migrate -- 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 -~----------~----~----~----~------~----~------~--~---
On Jan 30, 7:40 am, "Jim Lindley" <jimlind...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > rake db:migrate VERSION=0 > > > rake db:migrate > > > It doesn''t work. I don''t know why. It seems I have to go to mysql to > > drop the entire database.If something unexpected happens, the rake migrate task will leave it > up to you to clean up manually. It''s not smart enough to recover from > the many different things that can go wrong.Yeah - that''s a bit of an issue if you don''t capture the correct steps to migrate back down. Personally, I check I can migrate up and back down each step of the way (unless data is being destroyed in the migration, which make them very scary).> > You can run your migrations first as > > rake db:migrate --dry-run --trace > > That''ll catch some possible errors before running the migration for real.Nice tip. I would also recommend looking at ":force=>true" whenever you are creating a new table. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---