[Rails] Re: Migrate postgresql database to uuid

2013-10-28 Thread Kashif Umair Liaqat
By looking at your code, I assume that you have these models in your application. Site, Country,Payment, SiteUserRole and Event. If that's true then you don't have to worry about that. The migration, that I shared before, will iterate through all these models and ID in every database table will

[Rails] Re: Migrate postgresql database to uuid

2013-10-27 Thread kingston.s
I have model called user. user.rb class User < ActiveRecord::Base has_many :sites,:through=>:site_user_roles belongs_to :country has_many :payments has_and_belongs_to_many :events end like above i am having lots of association,now i want to migrate all the relation to u

[Rails] Re: Migrate postgresql database to uuid

2013-10-27 Thread Kashif Umair Liaqat
I could not understand that what do you mean by single instance migration with relation. Can you please elaborate more? On Monday, October 28, 2013 9:36:41 AM UTC+5, kingston.s wrote: > > For single instance migration we could do like this,what to be done if i > want to migrate single instance w

[Rails] Re: Migrate postgresql database to uuid

2013-10-27 Thread kingston.s
For single instance migration we could do like this,what to be done if i want to migrate single instance with the relation? On Sunday, October 27, 2013 9:57:57 AM UTC+5:30, Kashif Umair Liaqat wrote: > > You might need to write a migration or rake task for this purpose. > > Migration may look li

[Rails] Re: Migrate postgresql database to uuid

2013-10-26 Thread Kashif Umair Liaqat
You might need to write a migration or rake task for this purpose. Migration may look like this. class MigrateData < ActiveRecord::Migration def change get_all_models.each do |model| model.where('').find_each do |model_instance| model_instance.update_attributes id: UUIDTools