adapt financial transaction type for online payment provider

This commit is contained in:
Philipp Rothmann 2023-10-02 23:00:24 +02:00
parent c59eefd219
commit 2ef17ceca4
10 changed files with 66 additions and 25 deletions

View file

@ -0,0 +1,26 @@
class AddPaymentToFinancialTransaction < ActiveRecord::Migration[7.0]
def change
reversible do |dir|
dir.up do
change_column :financial_transactions, :amount, :decimal, :precision => 8, :scale => 2, :default => nil, :null => true
end
dir.down do
change_column :financial_transactions, :amount, :decimal, :precision => 8, :scale => 2, :default => 0, :null => false
end
end
add_column :financial_transactions, :updated_on, :timestamp
add_column :financial_transactions, :payment_method, :string
add_column :financial_transactions, :payment_plugin, :string
add_column :financial_transactions, :payment_id, :string
add_column :financial_transactions, :payment_amount, :decimal, :precision => 8, :scale => 3
add_column :financial_transactions, :payment_currency, :string
add_column :financial_transactions, :payment_state, :string
add_column :financial_transactions, :payment_fee, :decimal, :precision => 8, :scale => 3
add_column :financial_transactions, :payment_acct_number, :string
add_column :financial_transactions, :payment_acct_name, :string
add_column :financial_transactions, :payment_info, :text
add_index :financial_transactions, [:payment_plugin, :payment_id]
end
end

View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2023_02_15_085312) do
ActiveRecord::Schema[7.0].define(version: 2023_09_15_093041) do
create_table "action_text_rich_texts", charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t|
t.string "name", null: false
t.text "body", size: :long
@ -159,7 +159,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_02_15_085312) do
create_table "financial_transactions", id: :integer, charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t|
t.integer "ordergroup_id"
t.decimal "amount", precision: 8, scale: 2, default: "0.0", null: false
t.decimal "amount", precision: 8, scale: 2
t.text "note", null: false
t.integer "user_id", default: 0, null: false
t.datetime "created_on", precision: nil, null: false
@ -167,7 +167,19 @@ ActiveRecord::Schema[7.0].define(version: 2023_02_15_085312) do
t.integer "financial_link_id"
t.integer "reverts_id"
t.integer "group_order_id"
t.timestamp "updated_on"
t.string "payment_method"
t.string "payment_plugin"
t.string "payment_id"
t.decimal "payment_amount", precision: 8, scale: 3
t.string "payment_currency"
t.string "payment_state"
t.decimal "payment_fee", precision: 8, scale: 3
t.string "payment_acct_number"
t.string "payment_acct_name"
t.text "payment_info"
t.index ["ordergroup_id"], name: "index_financial_transactions_on_ordergroup_id"
t.index ["payment_plugin", "payment_id"], name: "index_financial_transactions_on_payment_plugin_and_payment_id"
t.index ["reverts_id"], name: "index_financial_transactions_on_reverts_id", unique: true
end