Class: CreateSolrengineSdpTransfers

Inherits:
Object
  • Object
show all
Defined in:
lib/generators/solrengine/sdp/templates/create_solrengine_sdp_transfers.rb

Overview

Engine-owned record of every transfer the app attempts through SDP — the row is the audit trail and the thing the app renders. See Solrengine::Sdp::Transfer for the status state machine.

Instance Method Summary collapse

Instance Method Details

#changeObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/generators/solrengine/sdp/templates/create_solrengine_sdp_transfers.rb', line 5

def change
  create_table :solrengine_sdp_transfers do |t|
    t.string :sdp_transfer_id              # nil until SDP responds (POST timeout → reconcile)
    t.string :source_wallet_id, null: false
    t.string :destination, null: false
    t.string :token, null: false, default: "SOL"
    t.string :amount, null: false          # decimal string — never a float
    t.string :memo                         # the app's memo (composes with memo_token)
    t.string :memo_token, null: false      # engine reconcile token
    t.string :status, null: false, default: "processing"
    t.string :sdp_status
    t.string :signature
    t.string :sdp_error
    t.datetime :submitted_at
    t.datetime :settled_at

    t.timestamps
  end

  add_index :solrengine_sdp_transfers, :memo_token, unique: true
  add_index :solrengine_sdp_transfers, :status
end