diff options
| author | Vlatka Pavisic | 2017-02-14 12:25:23 +0100 | 
|---|---|---|
| committer | Vlatka Pavisic | 2017-02-14 12:25:23 +0100 | 
| commit | 3bfb926a160228e437d7b3564ce5c177006fe51f (patch) | |
| tree | 44b90d7732cacd6a95853ba27d128f2f7d384a8a /db | |
| parent | 6c6f0def73a6228a48f8f3ccdcd62a99e6332798 (diff) | |
| download | chouette-core-3bfb926a160228e437d7b3564ce5c177006fe51f.tar.bz2 | |
Refs #2596 : Use update_all in migration
Diffstat (limited to 'db')
| -rw-r--r-- | db/migrate/20170213135212_add_timestamps_to_some_models.rb | 6 | 
1 files changed, 1 insertions, 5 deletions
diff --git a/db/migrate/20170213135212_add_timestamps_to_some_models.rb b/db/migrate/20170213135212_add_timestamps_to_some_models.rb index 4c5797058..72a90255b 100644 --- a/db/migrate/20170213135212_add_timestamps_to_some_models.rb +++ b/db/migrate/20170213135212_add_timestamps_to_some_models.rb @@ -6,12 +6,8 @@ class AddTimestampsToSomeModels < ActiveRecord::Migration      models.each do |table|        if !column_exists?(table, :created_at) && column_exists?(table, :creation_time)          add_timestamps table - -        Object.const_get("Chouette::#{table.to_s.classify}").all.each do |record| -          record.update(created_at: record.creation_time) if record.respond_to? :creation_time -        end +        Object.const_get("Chouette::#{table.to_s.classify}").record_class.update_all 'created_at = creation_time'        end -        remove_column table, :creation_time if column_exists?(table, :creation_time)      end    end  | 
