add mutations to exchange painel
This commit is contained in:
@@ -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
|
||||
@@ -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
|
||||
6
db/schema.rb
generated
6
db/schema.rb
generated
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2021_08_14_194513) do
|
||||
ActiveRecord::Schema.define(version: 2021_08_16_015156) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
@@ -70,7 +70,7 @@ ActiveRecord::Schema.define(version: 2021_08_14_194513) do
|
||||
t.bigint "currency_id", null: false
|
||||
t.string "status", null: false
|
||||
t.integer "paid_amount_cents", default: 0, null: false
|
||||
t.decimal "received_amount", precision: 20, scale: 10
|
||||
t.decimal "received_amount", precision: 20, scale: 10, default: "0.0", null: false
|
||||
t.datetime "created_at", precision: 6, null: false
|
||||
t.datetime "updated_at", precision: 6, null: false
|
||||
t.index ["currency_id"], name: "index_buy_crypto_orders_on_currency_id"
|
||||
@@ -97,7 +97,7 @@ ActiveRecord::Schema.define(version: 2021_08_14_194513) do
|
||||
t.bigint "currency_id", null: false
|
||||
t.string "status", null: false
|
||||
t.decimal "paid_amount", precision: 20, scale: 10, default: "0.0", null: false
|
||||
t.integer "received_amount_cents"
|
||||
t.integer "received_amount_cents", default: 0, null: false
|
||||
t.datetime "created_at", precision: 6, null: false
|
||||
t.datetime "updated_at", precision: 6, null: false
|
||||
t.index ["currency_id"], name: "index_sell_crypto_orders_on_currency_id"
|
||||
|
||||
Reference in New Issue
Block a user