Hi, Is there a way to specify parameters to :drop_table? ":create_table" has :options, but ":drop_table" does not. Before creating tables using migrations, I need to drop them in a particular order, due to foreign keys. To do this, I need to specify the SQL "if exists" condition. Is there a parameter for doing this? I''ve resorted to wrapping each ":drop_table" in a begin... rescue block, but was wondering if there was a better way? begin drop_table :my_table rescue Exception => exc puts "Error1: #{exc}" end Thanks, Bart --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hey Bart, are you aware of the :force option on create_table? Maybe this already resolves your issues... Cheers, Jan -- http://www.inviado.de - Internetseiten fr RAe http://www.xing.com/profile/Jan_Prill --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Jan, Yes, the :force would work, but because of foreign keys, I need to drop all tables first, and in reverse order of creating them. If there is any data, a drop_table fails because it would violate a fk requirements on a different table. I could also use the execute command to call the drop table command myself, but that would be DB specific. Or empty the tables first. I think that may work too. Any thoughts? Thanks, Bart --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---