code.vegaprotocol.io/vega@v0.79.0/datanode/sqlstore/migrations/0073_add_quantum_amount_in_rewards.sql (about) 1 -- +goose Up 2 3 alter table rewards 4 add column if not exists quantum_amount HUGEINT null; 5 6 -- +goose StatementBegin 7 -- This computes the quantum_amount for old data. 8 do 9 $$ 10 begin 11 update rewards 12 set quantum_amount = (select assets_current.quantum * rewards.amount from assets_current where assets_current.id = rewards.asset_id); 13 14 alter table rewards 15 alter column quantum_amount set not null; 16 17 end 18 $$; 19 -- +goose StatementEnd 20 21 22 -- +goose Down 23 24 alter table rewards 25 drop column if exists quantum_amount;