```ruby
class SetValueAsEarnableCoins < ActiveRecord::Migration
  def change
    Wip.find_each do |wip|
      begin
        wip.value = wip.respond_to?(:contracts) && wip.contracts.earnable_cents.to_i
        wip.save!
      rescue
      end
    end
  end
end
```

Set the value from the coins cache
user
```ruby
class SetValueAsEarnableCoins < ActiveRecord::Migration
  def change
    Wip.update_all('value = earnable_coins_cache')
  end
end
```
assistant