+ Entity Relationship Diagram

Scroll to zoom Drag to pan Double-click to fit 100%
erDiagram ACHAccount { string id PK string type datetime created bool is_deleted bool verification_failed } ACHAccount }o--|| Account : account ACHRewardRate { string id PK int reward_rate_percentage int spending_min bool is_enabled } ACHTransfer { string id PK datetime created string type int amount int source FK } ACHTransfer }o--|| ACHAccount : source ACHTransfer }o--|| ACHAccount : destination MarqetaACHOTransfer { string id PK string bank_transfer_destination int amount int admin_user FK string bank_transfer_token } MarqetaACHOTransfer }o--|| User : admin_user SettlementAccountBalance { string id PK string settlement_account_name string asset_currency int balance }

ACHAccount

Table: fold_ach_account
Field Type Constraints
id UUIDField PK default=uuid4
type TextField choicesShow 4 choices
DIRECT_DEPOSIT_BUFFERDirect Deposit Buffer
GIFTGift
CUSTOMER_SUPPORTCUSTOMER_SUPPORT
GIFT_CARD_REFUNDGift Card Refund
created DateTimeField indexed
is_deleted BooleanField default=False
verification_failed BooleanField default=False
verification_debug_data JSONField nullable
account FK → Account
name TextField
institution_name TextField
plaid_institution_id TextField nullable
plaid_account_id TextField nullable
plaid_access_token TextField unique nullable
dwolla_funding_id UUIDField unique nullable
stripe_bank_account_token TextField nullable
has_astra BooleanField default=False

Relationships

.account N:1 Account

Referenced By (3 tables)

ACHTransfer N:1 .source
ACHTransfer N:1 .destination
StripePaymentMethod N:1 .ach_account

Sample Queries (click to expand)

Get all records
ACHAccount.objects.all()
Get by ID
ACHAccount.objects.get(id=1)
With related Account
ACHAccount.objects.select_related("account")
Filter by account
ACHAccount.objects.filter(account_id=123)
Filter by created (last 7 days)
ACHAccount.objects.filter(created__gte=datetime.now()-timedelta(days=7))

ACHRewardRate

Table: fold_ach_reward_rate Extends: BaseModelMixin
Field Type Constraints
id BigAutoField PK
reward_rate_percentage DecimalField(4,2)
spending_min PositiveIntegerField nullable
is_enabled BooleanField default=False

Referenced By (1 tables)

FoldCardTransaction N:1 .ach_reward_rate

Sample Queries (click to expand)

Get all records
ACHRewardRate.objects.all()
Get by ID
ACHRewardRate.objects.get(id=1)

ACHTransfer

Table: fold_ach_transfer
Field Type Constraints
id UUIDField PK default=uuid4
created DateTimeField
type TextField choicesShow 4 choices
DIRECT_DEPOSIT_BUFFERDirect Deposit Buffer
GIFTGift
CUSTOMER_SUPPORTCUSTOMER_SUPPORT
GIFT_CARD_REFUNDGift Card Refund
amount DecimalField(10,2)
source FK → ACHAccount nullable
destination FK → ACHAccount nullable
leg1_status TextField nullable
leg1_failure_explanation TextField nullable
leg2_status TextField nullable
leg2_failure_explanation TextField nullable
fold_card_transaction OneToOne → FoldCardTransaction nullable

Relationships

.source N:1 ACHAccount
.destination N:1 ACHAccount
.fold_card_transaction 1:1 FoldCardTransaction

Referenced By (1 tables)

DwollaEvent N:1 .ach_transfer

Sample Queries (click to expand)

Get all records
ACHTransfer.objects.all()
Get by ID
ACHTransfer.objects.get(id=1)
With related ACHAccount
ACHTransfer.objects.select_related("source")
Filter by created (last 7 days)
ACHTransfer.objects.filter(created__gte=datetime.now()-timedelta(days=7))

MarqetaACHOTransfer

Table: fold_acho_transfer Extends: BaseModelMixin
Field Type Constraints
id BigAutoField PK
bank_transfer_destination CharField(250) choices nullableACHOExternalAccounts
amount DecimalField(10,2)
admin_user FK → User nullable
bank_transfer_token CharField(250) nullable
status CharField(255) choices default=valueMarqetaACHOTransferStatus
is_triggered BooleanField default=False

Relationships

.admin_user N:1 User

Sample Queries (click to expand)

Get all records
MarqetaACHOTransfer.objects.all()
Get by ID
MarqetaACHOTransfer.objects.get(id=1)
With related User
MarqetaACHOTransfer.objects.select_related("admin_user")

SettlementAccountBalance

Table: fold_settlement_account_balance Extends: BaseModelMixin
Field Type Constraints
id BigAutoField PK
settlement_account_name CharField(250) choicesSettlementAccounts
asset_currency CharField(250) choicesSettlementCurrencies
balance DecimalField(10,2)

Sample Queries (click to expand)

Get all records
SettlementAccountBalance.objects.all()
Get by ID
SettlementAccountBalance.objects.get(id=1)