class DropPatchVersionVersionField < ActiveRecord::Migration def self.up execute "DROP VIEW patch_view" execute < "created_at").each_with_index do |pv,i| pv.version = i+1 pv.save end end end end