Commit e66ee1cd17187a6f80bbe5f7200122e84c7d1539
1 parent
6de768c4
Exists in
master
and in
23 other branches
Replaces ruby code with sql code in migration
Showing
1 changed file
with
2 additions
and
8 deletions
Show diff stats
plugins/custom_forms/db/migrate/20131107050913_add_position_to_field_and_alternatives.rb
| ... | ... | @@ -4,15 +4,9 @@ class AddPositionToFieldAndAlternatives < ActiveRecord::Migration |
| 4 | 4 | t.integer :position, :default => 0 |
| 5 | 5 | end |
| 6 | 6 | |
| 7 | - CustomFormsPlugin::Field.find_each do |f| | |
| 8 | - f.position = f.id | |
| 9 | - f.save! | |
| 10 | - end | |
| 7 | + update("UPDATE custom_forms_plugin_fields SET position=id") | |
| 8 | + update("UPDATE custom_forms_plugin_alternatives SET position=id") | |
| 11 | 9 | |
| 12 | - CustomFormsPlugin::Alternative.find_each do |f| | |
| 13 | - f.position = f.id | |
| 14 | - f.save! | |
| 15 | - end | |
| 16 | 10 | end |
| 17 | 11 | |
| 18 | 12 | def self.down | ... | ... |