Files
sure/db/migrate/20260329111830_create_binance_items_and_accounts.rb
Louis 455c74dcfa Add Binance support, heavily inspired by the Coinbase one (#1317)
* feat: add Binance support (Items, Accounts, Importers, Processor, and Sync)

* refactor: deduplicate 'stablecoins' constant and push stale_rate filter to SQL

---------

Signed-off-by: Juan José Mata <juanjo.mata@gmail.com>
Co-authored-by: Juan José Mata <juanjo.mata@gmail.com>
2026-04-07 14:43:17 +02:00

49 lines
1.3 KiB
Ruby

class CreateBinanceItemsAndAccounts < ActiveRecord::Migration[7.2]
def change
create_table :binance_items, id: :uuid do |t|
t.references :family, null: false, foreign_key: true, type: :uuid
t.string :name
t.string :institution_name
t.string :institution_domain
t.string :institution_url
t.string :institution_color
t.string :status, default: "good"
t.boolean :scheduled_for_deletion, default: false
t.boolean :pending_account_setup, default: false
t.datetime :sync_start_date
t.jsonb :raw_payload
t.text :api_key
t.text :api_secret
t.timestamps
end
add_index :binance_items, :status
create_table :binance_accounts, id: :uuid do |t|
t.references :binance_item, null: false, foreign_key: true, type: :uuid
t.string :name
t.string :account_type
t.string :currency
t.decimal :current_balance, precision: 19, scale: 4
t.jsonb :institution_metadata
t.jsonb :raw_payload
t.jsonb :raw_transactions_payload
t.jsonb :extra, default: {}, null: false
t.timestamps
end
add_index :binance_accounts, :account_type
add_index :binance_accounts, [ :binance_item_id, :account_type ],
unique: true,
name: "index_binance_accounts_on_item_and_type"
end
end