diff --git a/db/migrate/20191226024813_crop_harvest_counter_cache.rb b/db/migrate/20191226024813_crop_harvest_counter_cache.rb index d0b9c2082..b942bfde3 100644 --- a/db/migrate/20191226024813_crop_harvest_counter_cache.rb +++ b/db/migrate/20191226024813_crop_harvest_counter_cache.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CropHarvestCounterCache < ActiveRecord::Migration[5.2] def change change_table :crops do |t| @@ -7,6 +9,7 @@ class CropHarvestCounterCache < ActiveRecord::Migration[5.2] dir.up { set_counter_value } end end + def set_counter_value execute <<-SQL.squish UPDATE crops diff --git a/db/migrate/20191226024957_crop_photo_counter_cache.rb b/db/migrate/20191226024957_crop_photo_counter_cache.rb index 3bb4ebe68..d4a085e24 100644 --- a/db/migrate/20191226024957_crop_photo_counter_cache.rb +++ b/db/migrate/20191226024957_crop_photo_counter_cache.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CropPhotoCounterCache < ActiveRecord::Migration[5.2] def change change_table :crops do |t| @@ -7,6 +9,7 @@ class CropPhotoCounterCache < ActiveRecord::Migration[5.2] dir.up { set_counter_value } end end + def set_counter_value execute <<-SQL.squish UPDATE crops