+ Entity Relationship Diagram

Scroll to zoom Drag to pan Double-click to fit 100%
erDiagram Account { string id PK string api_id string partner_id bool receive_marketing bool accepted_privacy_policy } Account ||--|| AccountCreated : created Account }o--|| AccountAddress : shipping_address Account }o--|| AccountAddress : billing_address AccountActivationToken { string id PK int account FK datetime expiration string token bool used } AccountActivationToken }o--|| Account : account AccountAddress { string id PK int account FK string type string address_1_tokenized string address_2_tokenized } AccountAddress }o--|| Account : account AccountAdminNote { string id PK int account FK string note int admin_user FK } AccountAdminNote }o--|| Account : account AccountAdminNote }o--|| User : admin_user AccountAstraCustomer { string id PK string account FK string access_token datetime access_token_expires_at string refresh_token } AccountAstraCustomer ||--|| Account : account AccountCreated { string id PK } AccountDevice { string id PK int account FK int device FK } AccountDevice }o--|| Account : account AccountDwollaCustomer { string id PK string account FK string customer_id string status bool has_negative_balance } AccountDwollaCustomer ||--|| Account : account AccountEmail { string id PK int account FK string address datetime time } AccountEmail }o--|| Account : account AccountEvent { string id PK int account FK datetime time } AccountEvent }o--|| Account : account AccountKycErrorResponse { string id PK string error_codes string response } AccountMfaChallengeLog { string id PK int account FK int account_session FK bool successful datetime timestamp } AccountMfaChallengeLog }o--|| Account : account AccountMfaChallengeLog }o--|| AccountSession : account_session AccountOrderBonus { string id PK int account FK string created FK datetime expiry string used FK } AccountOrderBonus }o--|| Account : account AccountPhoneNumber { string id PK int account FK bool verified } AccountPhoneNumber }o--|| Account : account AccountPhoneNumberVerification { string id PK int account_phone_number FK int code datetime expiration bool completed } AccountPhoneNumberVerification }o--|| AccountPhoneNumber : account_phone_number AccountRole { string id PK int account FK string role } AccountRole }o--|| Account : account AccountRoleChange { string id PK int account FK string role string action datetime time } AccountRoleChange }o--|| Account : account AccountSeenFeature { string id PK string feature_name int account FK } AccountSeenFeature }o--|| Account : account AccountSession { string id PK int account FK string session FK int account_device FK datetime created } AccountSession }o--|| Account : account AccountSession }o--|| AccountDevice : account_device AccountSessionActivationToken { string id PK int account_session FK datetime expiration string token bool used } AccountSessionActivationToken }o--|| AccountSession : account_session AccountTwoFactorVerificationSMSCode { string id PK datetime expires_at int account_session FK int code bool is_used } AccountTwoFactorVerificationSMSCode }o--|| AccountSession : account_session AccountTwoFactorVerificationSMSCode ||--|| AccountTwoFactorVerificationToken : verification_token AccountTwoFactorVerificationToken { string token PK datetime expires_at int account_session FK string scope bool is_used } AccountTwoFactorVerificationToken }o--|| AccountSession : account_session AccountUsedPlatforms { string id PK int account FK string platform datetime time } AccountUsedPlatforms }o--|| Account : account BitgoAccount { string account FK string external_user_id PK string external_enterprise_id string external_identity_id string external_wallet_id } BitgoAccount ||--|| Account : account ExternalAccount { string id PK string external_account_token int account FK int fold_card_shipping_status int fold_card_kyc_status } ExternalAccount }o--|| Account : account ExternalAccountStatusAudit { string id PK int external_account FK string status string info } ExternalAccountStatusAudit }o--|| ExternalAccount : external_account FboCustodyBalance { string id PK string account FK int balance string bitgo_transfer_txid string bitgo_transfer_idempotency_key } FboCustodyBalance ||--|| Account : account FboCustodyBalanceChange { string id PK int fbo_custody_balance FK int delta int balance string type } FboCustodyBalanceChange }o--|| FboCustodyBalance : fbo_custody_balance FboCustodyBalanceChange }o--|| FortressAccountSnapshot : fortress_account_snapshot FortressAcceptTerm { string id PK string account FK bool accepted_terms } FortressAcceptTerm ||--|| Account : account FortressAccount { string account FK string external_identity_id PK string external_account_id string bitcoin_wallet_address bool purchasing_enabled } FortressAccount ||--|| Account : account FortressAccountSnapshot { string id PK int fortress_account FK int total_btc int disbursable_btc int locked_btc } FortressAccountSnapshot }o--|| FortressAccount : fortress_account PrimeTrustAccount { string account FK string external_id PK string status string cip_status string aml_status } PrimeTrustAccount ||--|| Account : account SardineExternalAccount { string id PK string token int account FK string status int submit_kyc_retries_used } SardineExternalAccount }o--|| Account : account TaxbitAccount { string account PK string external_account_id string external_tenant_id string external_owner_id string external_account_payer_id } TaxbitAccount ||--|| Account : account

Account

Table: fold_account
Field Type Constraints
id BigAutoField PK
api_id CharField(40) unique
partner_id CharField(32) nullable
receive_marketing BooleanField default=True
accepted_privacy_policy BooleanField default=False
latest_accepted_terms PositiveIntegerField default=0
rewards_activated BooleanField default=False
fold_issued_card_opt_in BooleanField default=False
usd_customer_id CharField(100) nullable
default_credit_card FK → CreditCard nullable
is_email_account BooleanField default=False
is_active BooleanField default=True
has_activated_a_card BooleanField default=False indexed
user OneToOneField
created OneToOne → AccountCreated nullable
restriction CharField(25) choices nullableShow 5 choices
NO_ORDER_CREATIONNo Order Creation
NO_ACCOUNT_ACCESSNo Account Access
NO_REWARDS_WITHDRAWALNo Rewards Withdrawal
NO_BITCOIN_WITHDRAWALNo Bitcoin Withdrawal
CLOSEDClosed
is_sms_verify_whitelisted BooleanField default=False
account_enabled_features M2M → Feature
fold_card_tier SmallIntegerField choices default=valueTiers
fold_card_requested_tier SmallIntegerField default=0
fold_card_membership_status SmallIntegerField choices default=NULL()Show 5 choices
0NULLNull
1PENDINGPending
2ACTIVEActive
3INACTIVEInactive
4LATE_RENEWAL_FEELate Renewal Fee
fold_card_renewal_datetime DateTimeField nullable
fold_card_last_renewal_attempt DateTimeField nullable
fold_card_subscription_auto_renewal_interval SmallIntegerField choices default=NULL()Show 2 choices
1MONTHLYmonthly
2YEARLYyearly
fold_card_credited_direct_deposit_buffer BooleanField default=False
primary_wallet CharField(250) choices nullableCustodians
ar_notification_opt_in BooleanField default=False
last_name CharField(128) nullable
ssn_tokenized CharField(250) nullable
shipping_address FK → AccountAddress nullable
billing_address FK → AccountAddress nullable
birth_date_tokenized CharField(250) nullable
first_name_tokenized CharField(250) nullable
middle_name_tokenized CharField(250) nullable
viral_loops_referral_code TextField nullable
daily_spin_last_grant_timestamp DateTimeField nullable
total_btc_earned_from_referring DecimalField(30,10) default=Decimal()

Relationships

.default_credit_card N:1 CreditCard
.created 1:1 AccountCreated
.account_enabled_features N:M Feature
.shipping_address N:1 AccountAddress
.billing_address N:1 AccountAddress

Referenced By (82 tables)

WithdrawAddress N:1 .account
AccountEmail N:1 .account
AccountRole N:1 .account
...and 72 more

Sample Queries (click to expand)

Get all records
Account.objects.all()
Get by ID
Account.objects.get(id=1)
With related CreditCard
Account.objects.select_related("default_credit_card")
Filter by fold_card_renewal_datetime (last 7 days)
Account.objects.filter(fold_card_renewal_datetime__gte=datetime.now()-timedelta(days=7))

Schema History (click to expand)

#0486RenameField2024-04-29
#0486RenameField2024-04-29
#0486RenameField2024-04-29
#0486RenameField2024-04-29
#0509AddField: total_btc_earned_from_referring2024-07-16
#0532AlterField: restriction2024-10-15
#0586AlterField: fold_card_tier2025-03-18
#0619AlterField: primary_wallet2025-08-20
#0622AlterField: primary_wallet2025-08-27
#0648AlterField: restriction2025-11-11

AccountActivationToken

Table: fold_accountactivationtoken
Field Type Constraints
id BigAutoField PK
account FK → Account
expiration DateTimeField
token CharField(20)
used BooleanField default=False

Relationships

.account N:1 Account

Sample Queries (click to expand)

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

AccountAddress

Table: account_address Extends: BaseModelMixin
Field Type Constraints
id BigAutoField PK
account FK → Account
type CharField(250) choicesAccountAddressType
address_1_tokenized CharField(250) nullable
address_2_tokenized CharField(250) nullable
city_tokenized CharField(250) nullable
state CharField(250) nullable
postal_code_tokenized CharField(250) nullable
country_tokenized CharField(250) nullable
is_active BooleanField default=True

Relationships

.account N:1 Account

Referenced By (3 tables)

Account N:1 .shipping_address
Account N:1 .billing_address
CardShipmentRequest N:1 .account_address

Sample Queries (click to expand)

Get all records
AccountAddress.objects.all()
Get by ID
AccountAddress.objects.get(id=1)
With related Account
AccountAddress.objects.select_related("account")
Filter by account
AccountAddress.objects.filter(account_id=123)

AccountAdminNote

Table: fold_account_admin_note Extends: BaseModelMixin
Field Type Constraints
id BigAutoField PK
account FK → Account
note TextField
admin_user FK → User

Relationships

.account N:1 Account
.admin_user N:1 User

Sample Queries (click to expand)

Get all records
AccountAdminNote.objects.all()
Get by ID
AccountAdminNote.objects.get(id=1)
With related Account
AccountAdminNote.objects.select_related("account")
Filter by account
AccountAdminNote.objects.filter(account_id=123)

AccountAstraCustomer

Table: fold_account_astra_customer
Field Type Constraints
id BigAutoField PK
account OneToOne → Account
access_token TextField nullable
access_token_expires_at DateTimeField nullable
refresh_token TextField nullable
refresh_token_expires_at DateTimeField nullable
user_intent_id TextField nullable
user_id TextField nullable
fold_astra_account_id TextField nullable indexed
astra_fold_card_id TextField nullable indexed

Relationships

.account 1:1 Account

Sample Queries (click to expand)

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

AccountCreated

Table: fold_account_created Extends: AccountEvent
Field Type Constraints
id BigAutoField PK

Referenced By (1 tables)

Account 1:1 .created

Sample Queries (click to expand)

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

AccountDevice

Table: fold_account_device
Field Type Constraints
id BigAutoField PK
account FK → Account
device FK → Device

Relationships

.account N:1 Account
.device N:1 Device

Referenced By (1 tables)

AccountSession N:1 .account_device

Sample Queries (click to expand)

Get all records
AccountDevice.objects.all()
Get by ID
AccountDevice.objects.get(id=1)
With related Account
AccountDevice.objects.select_related("account")
Filter by account
AccountDevice.objects.filter(account_id=123)

AccountDwollaCustomer

Table: fold_account_dwolla_customer
Field Type Constraints
id BigAutoField PK
account OneToOne → Account
customer_id UUIDField
status TextField nullable
has_negative_balance BooleanField default=False
identity_match_override BooleanField default=False indexed
reconciliation_admin_comment TextField nullable
balance_owed_charged_by_dwolla BooleanField default=False indexed

Relationships

.account 1:1 Account

Sample Queries (click to expand)

Get all records
AccountDwollaCustomer.objects.all()
Get by ID
AccountDwollaCustomer.objects.get(id=1)
With related Account
AccountDwollaCustomer.objects.select_related("account")
Filter by account
AccountDwollaCustomer.objects.filter(account_id=123)

AccountEmail

Table: fold_account_email
Field Type Constraints
id BigAutoField PK
account FK → Account
address CharField(256)
time DateTimeField default=now()

Relationships

.account N:1 Account

Sample Queries (click to expand)

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

AccountEvent

Table: fold_account_event Extends: SaveHooks
Field Type Constraints
id BigAutoField PK
account FK → Account
time DateTimeField default=now()

Relationships

.account N:1 Account

Referenced By (1 tables)

AccountEventBalanceChange N:1 .account_event

Sample Queries (click to expand)

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

AccountKycErrorResponse

Table: fold_account_kyc_error_response
Field Type Constraints
id BigAutoField PK
error_codes JSONField default=list()
response TextField

Sample Queries (click to expand)

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

AccountMfaChallengeLog

Table: fold_accountmfachallengelog
Field Type Constraints
id BigAutoField PK
account FK → Account
account_session FK → AccountSession
successful BooleanField
timestamp DateTimeField
method_type CharField(10)
device_id PositiveIntegerField

Relationships

.account N:1 Account
.account_session N:1 AccountSession

Sample Queries (click to expand)

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

AccountOrderBonus

Table: fold_account_order_bonus
Field Type Constraints
id BigAutoField PK
account FK → Account
created OneToOne → fold.AccountOrderBonusCreated nullable
expiry DateTimeField nullable
used OneToOne → fold.AccountOrderBonusUsed nullable
percentage DecimalField(30,8) nullable
amount_value DecimalField(30,8) nullable
amount_currency TextField(6)
order OneToOne → Order nullable
source_game_reward OneToOne → AccountGameReward nullable

Relationships

.account N:1 Account
.created 1:1 fold.AccountOrderBonusCreated
.used 1:1 fold.AccountOrderBonusUsed
.order 1:1 Order
.source_game_reward 1:1 AccountGameReward

Referenced By (1 tables)

AccountOrderBonusEvent N:1 .account_order_bonus

Sample Queries (click to expand)

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

AccountPhoneNumber

Table: fold_account_phone_number
Field Type Constraints
id BigAutoField PK
account FK → Account
verified BooleanField default=False

Relationships

.account N:1 Account

Referenced By (1 tables)

AccountPhoneNumberVerification N:1 .account_phone_number

Sample Queries (click to expand)

Get all records
AccountPhoneNumber.objects.all()
Get by ID
AccountPhoneNumber.objects.get(id=1)
With related Account
AccountPhoneNumber.objects.select_related("account")
Filter by account
AccountPhoneNumber.objects.filter(account_id=123)

AccountPhoneNumberVerification

Table: fold_accountphonenumberverification
Field Type Constraints
id BigAutoField PK
account_phone_number FK → AccountPhoneNumber
code PositiveIntegerField
expiration DateTimeField
completed BooleanField default=False
failed BooleanField default=False

Relationships

.account_phone_number N:1 AccountPhoneNumber

Sample Queries (click to expand)

Get all records
AccountPhoneNumberVerification.objects.all()
Get by ID
AccountPhoneNumberVerification.objects.get(id=1)
With related AccountPhoneNumber
AccountPhoneNumberVerification.objects.select_related("account_phone_number")
Filter by expiration (last 7 days)
AccountPhoneNumberVerification.objects.filter(expiration__gte=datetime.now()-timedelta(days=7))

AccountRole

Table: fold_account_role
Field Type Constraints
id BigAutoField PK
account FK → Account
role CharField(256)

Relationships

.account N:1 Account

Sample Queries (click to expand)

Get all records
AccountRole.objects.all()
Get by ID
AccountRole.objects.get(id=1)
With related Account
AccountRole.objects.select_related("account")
Filter by account
AccountRole.objects.filter(account_id=123)

AccountRoleChange

Table: fold_account_role_change
Field Type Constraints
id BigAutoField PK
account FK → Account
role CharField(30)
action CharField(10)
time DateTimeField

Relationships

.account N:1 Account

Sample Queries (click to expand)

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

AccountSeenFeature

Table: fold_accountseenfeature Extends: BaseModelMixin
Field Type Constraints
id BigAutoField PK
feature_name CharField(1000)
account FK → Account

Relationships

.account N:1 Account

Sample Queries (click to expand)

Get all records
AccountSeenFeature.objects.all()
Get by ID
AccountSeenFeature.objects.get(id=1)
With related Account
AccountSeenFeature.objects.select_related("account")
Filter by account
AccountSeenFeature.objects.filter(account_id=123)

AccountSession

Table: fold_account_session
Field Type Constraints
id BigAutoField PK
account FK → Account nullable
session OneToOne → Session nullable
account_device FK → AccountDevice nullable
created DateTimeField default=now()
ip GenericIPAddressField
is_activated BooleanField default=True
is_anonymous BooleanField default=False
sardine_session UUIDField unique default=uuid4

Relationships

.account N:1 Account
.session 1:1 Session
.account_device N:1 AccountDevice

Referenced By (4 tables)

AccountMfaChallengeLog N:1 .account_session
AccountSessionActivationToken N:1 .account_session

Sample Queries (click to expand)

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

AccountSessionActivationToken

Table: fold_accountsessionactivationtoken
Field Type Constraints
id BigAutoField PK
account_session FK → AccountSession
expiration DateTimeField
token CharField(6)
used BooleanField default=False

Relationships

.account_session N:1 AccountSession

Sample Queries (click to expand)

Get all records
AccountSessionActivationToken.objects.all()
Get by ID
AccountSessionActivationToken.objects.get(id=1)
With related AccountSession
AccountSessionActivationToken.objects.select_related("account_session")
Filter by expiration (last 7 days)
AccountSessionActivationToken.objects.filter(expiration__gte=datetime.now()-timedelta(days=7))

AccountTwoFactorVerificationSMSCode

Table: fold_account_two_factor_sms_code Extends: BaseModelMixin
Field Type Constraints
id BigAutoField PK
expires_at DateTimeField
account_session FK → AccountSession
code PositiveIntegerField
is_used BooleanField default=False
verification_token OneToOne → AccountTwoFactorVerificationToken nullable

Relationships

.account_session N:1 AccountSession
.verification_token 1:1 AccountTwoFactorVerificationToken

Sample Queries (click to expand)

Get all records
AccountTwoFactorVerificationSMSCode.objects.all()
Get by ID
AccountTwoFactorVerificationSMSCode.objects.get(id=1)
With related AccountSession
AccountTwoFactorVerificationSMSCode.objects.select_related("account_session")
Filter by expires_at (last 7 days)
AccountTwoFactorVerificationSMSCode.objects.filter(expires_at__gte=datetime.now()-timedelta(days=7))

AccountTwoFactorVerificationToken

Table: fold_account_two_factor_verification_token Extends: BaseModelMixin
Field Type Constraints
token UUIDField unique default=uuid4 PK
expires_at DateTimeField
account_session FK → AccountSession
scope CharField(255) nullable
is_used BooleanField default=False

Relationships

.account_session N:1 AccountSession

Referenced By (1 tables)

AccountTwoFactorVerificationSMSCode 1:1 .verification_token

Sample Queries (click to expand)

Get all records
AccountTwoFactorVerificationToken.objects.all()
Get by ID
AccountTwoFactorVerificationToken.objects.get(id=1)
With related AccountSession
AccountTwoFactorVerificationToken.objects.select_related("account_session")
Filter by expires_at (last 7 days)
AccountTwoFactorVerificationToken.objects.filter(expires_at__gte=datetime.now()-timedelta(days=7))

AccountUsedPlatforms

Table: fold_account_used_platforms
Field Type Constraints
id BigAutoField PK
account FK → Account
platform CharField(6) choices default=WEB()Show 2 choices
MOBILEMobile
WEBWeb
time DateTimeField default=now()

Relationships

.account N:1 Account

Sample Queries (click to expand)

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

BitgoAccount

Table: fold_bitgo_account Extends: BaseModelMixin
Field Type Constraints
account OneToOne → Account
external_user_id CharField(250) PK
external_enterprise_id CharField(250) indexed
external_identity_id CharField(250) indexed nullable
external_wallet_id CharField(250) indexed nullable
fbo_transfer_from_policy_applied BooleanField default=False
fbo_transfer_to_policy_applied BooleanField default=False
fee_transfer_to_policy_applied BooleanField default=False
gift_card_fbo_transfer_from_policy_applied BooleanField default=False
bitcoin_wallet_address CharField(250) indexed nullable
tokenized_wallet_password CharField(250) nullable
purchasing_enabled BooleanField default=False
identity_kyc_status CharField(250) choices nullableBitgoIdentityKYCStatus
enterprise_kyc_status CharField(250) choices nullableBitgoEnterpriseKYCStatus
kyc_fail_reason CharField(250) nullable
accepted_terms BooleanField default=False
signed_csa_version CharField(100) nullable
signed_mpa_version CharField(100) nullable
signed_wvr_version CharField(100) nullable
signed_csa_datetime DateTimeField nullable
signed_mpa_datetime DateTimeField nullable
signed_wvr_datetime DateTimeField nullable
transfer_batch FK → BitgoTransferBatch nullable
password_reset_sent BooleanField default=False
gift_card_policy_backfilled BooleanField default=False
kyc_document_id CharField(250) nullable

Relationships

.account 1:1 Account
.transfer_batch N:1 BitgoTransferBatch

Referenced By (5 tables)

WalletQuote N:1 .bitgo_account
WalletWithdrawal N:1 .bitgo_account
WalletDeposit N:1 .bitgo_account
BitcoinGiftCardQuote N:1 .bitgo_account
BitgoTransferAudit 1:1 .bitgo_account

Sample Queries (click to expand)

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

ExternalAccount

Table: fold_external_account Extends: BaseModelMixin
Field Type Constraints
id BigAutoField PK
external_account_token CharField(255) unique nullable
account FK → Account nullable
fold_card_shipping_status SmallIntegerField choices default=valueFoldCardShippingStatus
fold_card_kyc_status SmallIntegerField choices default=valueFoldCardKycStatus
fold_card_kyc_status_modified_at DateTimeField nullable
fold_card_kyc_reference_id CharField(255) nullable
fold_card_kyc_admin_comment TextField nullable
fold_card_kyc_docs_requested TextField nullable
fold_card_kyc_error_codes JSONField default=list()
vendor_id SmallIntegerField choices default=valueVendor
status CharField(255) choices default=valueFoldCardStatus

Relationships

.account N:1 Account

Referenced By (3 tables)

ExternalAccountStatusAudit N:1 .external_account
AuthorizedUser N:1 .external_account
CardShipmentRequest N:1 .external_account

Sample Queries (click to expand)

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

ExternalAccountStatusAudit

Table: fold_externalaccountstatusaudit Extends: BaseModelMixin
Field Type Constraints
id BigAutoField PK
external_account FK → ExternalAccount
status CharField(255)
info JSONField default=dict() nullable

Relationships

.external_account N:1 ExternalAccount

Sample Queries (click to expand)

Get all records
ExternalAccountStatusAudit.objects.all()
Get by ID
ExternalAccountStatusAudit.objects.get(id=1)
With related ExternalAccount
ExternalAccountStatusAudit.objects.select_related("external_account")

FboCustodyBalance

Table: fold_fbo_custody_balance Extends: BaseModelMixin
Field Type Constraints
id BigAutoField PK
account OneToOne → Account
balance DecimalField(30,8) default=Decimal()
bitgo_transfer_txid CharField(64) nullable
bitgo_transfer_idempotency_key UUIDField default=uuid4

Relationships

.account 1:1 Account

Referenced By (1 tables)

FboCustodyBalanceChange N:1 .fbo_custody_balance

Sample Queries (click to expand)

Get all records
FboCustodyBalance.objects.all()
Get by ID
FboCustodyBalance.objects.get(id=1)
With related Account
FboCustodyBalance.objects.select_related("account")
Filter by account
FboCustodyBalance.objects.filter(account_id=123)

FboCustodyBalanceChange

Table: fold_fbo_custody_balance_change Extends: BaseModelMixin
Field Type Constraints
id BigAutoField PK
fbo_custody_balance FK → FboCustodyBalance
delta DecimalField(30,8)
balance DecimalField(30,8)
type CharField(20) choicesShow 4 choices
initial_balanceINITIAL_BALANCEInitial Balance
withdrawalWITHDRAWALWithdrawal
adjustmentADJUSTMENTAdjustment
onboardONBOARDOnboard
fortress_account_snapshot FK → FortressAccountSnapshot nullable

Relationships

.fbo_custody_balance N:1 FboCustodyBalance
.fortress_account_snapshot N:1 FortressAccountSnapshot

Sample Queries (click to expand)

Get all records
FboCustodyBalanceChange.objects.all()
Get by ID
FboCustodyBalanceChange.objects.get(id=1)
With related FboCustodyBalance
FboCustodyBalanceChange.objects.select_related("fbo_custody_balance")

FortressAcceptTerm

Table: fold_fortress_accept_term Extends: BaseModelMixin
Field Type Constraints
id BigAutoField PK
account OneToOne → Account
accepted_terms BooleanField default=False

Relationships

.account 1:1 Account

Sample Queries (click to expand)

Get all records
FortressAcceptTerm.objects.all()
Get by ID
FortressAcceptTerm.objects.get(id=1)
With related Account
FortressAcceptTerm.objects.select_related("account")
Filter by account
FortressAcceptTerm.objects.filter(account_id=123)

FortressAccount

Table: fold_fortress_account Extends: BaseModelMixin
Field Type Constraints
account OneToOne → Account
external_identity_id UUIDField PK
external_account_id UUIDField nullable indexed
bitcoin_wallet_address CharField(250) indexed nullable
purchasing_enabled BooleanField default=False
kyc_level CharField(250) choices nullableFortressKycLevels

Relationships

.account 1:1 Account

Referenced By (6 tables)

FortressAccountSnapshot N:1 .fortress_account
WalletQuote N:1 .fortress_account
WalletWithdrawal N:1 .fortress_account
WalletDeposit N:1 .fortress_account
BitcoinGiftCardQuote N:1 .fortress_account
BitgoTransferAudit 1:1 .fortress_account

Sample Queries (click to expand)

Get all records
FortressAccount.objects.all()
Get by ID
FortressAccount.objects.get(id=1)
With related Account
FortressAccount.objects.select_related("account")
Filter by account
FortressAccount.objects.filter(account_id=123)

FortressAccountSnapshot

Table: fold_fortress_account_snapshot Extends: BaseModelMixin
Field Type Constraints
id BigAutoField PK
fortress_account FK → FortressAccount
total_btc DecimalField(10,8)
disbursable_btc DecimalField(10,8)
locked_btc DecimalField(10,8) default=0
pending_btc DecimalField(10,8) default=0
total_usd DecimalField(10,2) default=0
disbursable_usd DecimalField(10,2) default=0
locked_usd DecimalField(10,2) default=0
pending_usd DecimalField(10,2) default=0

Relationships

.fortress_account N:1 FortressAccount

Referenced By (1 tables)

FboCustodyBalanceChange N:1 .fortress_account_snapshot

Sample Queries (click to expand)

Get all records
FortressAccountSnapshot.objects.all()
Get by ID
FortressAccountSnapshot.objects.get(id=1)
With related FortressAccount
FortressAccountSnapshot.objects.select_related("fortress_account")

PrimeTrustAccount

Table: fold_prime_trust_account Extends: BaseModelMixin
Field Type Constraints
account OneToOne → Account
external_id UUIDField PK
status TextField nullable
cip_status TextField nullable
aml_status TextField nullable
purchasing_enabled BooleanField default=True

Relationships

.account 1:1 Account

Referenced By (4 tables)

WalletQuote N:1 .prime_trust_account
WalletWithdrawal N:1 .prime_trust_account
WalletDeposit N:1 .prime_trust_account
FortressTransferAudit 1:1 .prime_trust_account

Sample Queries (click to expand)

Get all records
PrimeTrustAccount.objects.all()
Get by ID
PrimeTrustAccount.objects.get(id=1)
With related Account
PrimeTrustAccount.objects.select_related("account")
Filter by account
PrimeTrustAccount.objects.filter(account_id=123)

SardineExternalAccount

Table: fold_sardineexternalaccount Extends: BaseModelMixin
Field Type Constraints
id BigAutoField PK
token CharField(255) unique nullable
account FK → Account nullable
status CharField(255) choices default=valueSardineExternalAccountStatus
submit_kyc_retries_used PositiveIntegerField default=0
kyc_docs_reference_id CharField(255) nullable
document_id_expiration_date CharField(100) nullable

Relationships

.account N:1 Account

Referenced By (1 tables)

SardineExternalAccountStatusAudit N:1 .sardine_external_account

Sample Queries (click to expand)

Get all records
SardineExternalAccount.objects.all()
Get by ID
SardineExternalAccount.objects.get(id=1)
With related Account
SardineExternalAccount.objects.select_related("account")
Filter by account
SardineExternalAccount.objects.filter(account_id=123)

TaxbitAccount

Table: fold_taxbit_account Extends: BaseModelMixin
Field Type Constraints
account OneToOne → Account PK
external_account_id UUIDField nullable
external_tenant_id UUIDField nullable
external_owner_id UUIDField nullable
external_account_payer_id UUIDField nullable
status CharField(250) choices nullableTaxDocumentStatus

Relationships

.account 1:1 Account

Sample Queries (click to expand)

Get all records
TaxbitAccount.objects.all()
Get by ID
TaxbitAccount.objects.get(id=1)
With related Account
TaxbitAccount.objects.select_related("account")
Filter by account
TaxbitAccount.objects.filter(account_id=123)