add mutations to exchange painel

This commit is contained in:
João Geonizeli
2021-08-15 23:30:53 -03:00
parent 0ccd01abfd
commit 19a08cd50e
29 changed files with 702 additions and 198 deletions

View File

@@ -0,0 +1,14 @@
# frozen_string_literal: true
class AddDefaultValueToSellCryptoOrderRecivedAmountCents < ActiveRecord::Migration[6.1]
def change
# rubocop:disable Rails/ReversibleMigration
execute(<<-SQL.squish)
UPDATE sell_crypto_orders
SET received_amount_cents = 0
WHERE received_amount_cents IS NULL
SQL
change_column_default(:sell_crypto_orders, :received_amount_cents, from: nil, to: 0)
change_column_null(:sell_crypto_orders, :received_amount_cents, false)
end
end

View File

@@ -0,0 +1,14 @@
# frozen_string_literal: true
class AddDefaultValueToBuyCriptoPaidAmountCents < ActiveRecord::Migration[6.1]
def change
# rubocop:disable Rails/ReversibleMigration
execute(<<-SQL.squish)
UPDATE buy_crypto_orders
SET received_amount = 0
WHERE received_amount IS NULL
SQL
change_column_default(:buy_crypto_orders, :received_amount, from: nil, to: 0)
change_column_null(:buy_crypto_orders, :received_amount, false)
end
end