My project has a model, Client
, which I now have to split up into AClient
and BClient
. I've created a migration to add the type
column and update all existing clients to become AClients
. This is what the up method looks like:
def self.up
add_column :clients, :type, :string
Client.update_all(type: "AClient")
end
The migration has now taken over 15 minutes and it is still going. It shouldn't take this long to update 1210 records, should it? Is there a faster/better way to do this?
(I'm working with Rails 3.0.2 and Ruby 1.9.3p547 with a postgreSQL database.)
Aucun commentaire:
Enregistrer un commentaire