+ Entity Relationship Diagram

Scroll to zoom Drag to pan Double-click to fit 100%
erDiagram AccountEventBalanceChange { string id PK int account_event FK int balance_change FK } AccountEventBalanceChange }o--|| BalanceChange : balance_change BalanceChange { string id PK int current_balance FK int delta datetime time int order FK } BalanceChange }o--|| CurrentBalance : current_balance CurrentBalance { string id PK int profile FK int amount string currency bool special } CurrentBalanceEvent { string id PK int current_balance FK } CurrentBalanceEvent }o--|| CurrentBalance : current_balance DefaultWithdrawAddress { string id PK int withdraw_address FK }

AccountEventBalanceChange

Table: fold_account_event_balance_change
Field Type Constraints
id BigAutoField PK
account_event FK → AccountEvent
balance_change FK → BalanceChange

Relationships

.account_event N:1 AccountEvent
.balance_change N:1 BalanceChange

Sample Queries (click to expand)

Get all records
AccountEventBalanceChange.objects.all()
Get by ID
AccountEventBalanceChange.objects.get(id=1)
With related AccountEvent
AccountEventBalanceChange.objects.select_related("account_event")

BalanceChange

Table: fold_balancechange
Field Type Constraints
id BigAutoField PK
current_balance FK → CurrentBalance
delta DecimalField(30,8)
time DateTimeField default=now()
order FK → Order nullable
withdrawal FK → Withdrawal nullable

Relationships

.current_balance N:1 CurrentBalance
.order N:1 Order
.withdrawal N:1 Withdrawal

Referenced By (13 tables)

AccountEventBalanceChange N:1 .balance_change
RewardWithdrawalRequest 1:1 .balance_change
MetaverseGamePlay 1:1 .balance_change
ReferralOrderConversion 1:1 .balance_change
ReferralEvent 1:1 .balance_change
AccountGameReward 1:1 .balance_change
FoldCardTransaction 1:1 .base_reward_balance_change
FoldCardTransaction 1:1 .ach_reward_balance_change
FoldCardTransaction 1:1 .merchant_boost_reward_balance_change
...and 3 more

Sample Queries (click to expand)

Get all records
BalanceChange.objects.all()
Get by ID
BalanceChange.objects.get(id=1)
With related CurrentBalance
BalanceChange.objects.select_related("current_balance")
Filter by time (last 7 days)
BalanceChange.objects.filter(time__gte=datetime.now()-timedelta(days=7))

CurrentBalance

Table: fold_currentbalance
Field Type Constraints
id BigAutoField PK
profile FK → CardForCoinProfile nullable
amount DecimalField(30,8) default=Decimal()
currency CharField(30)
special BooleanField default=False

Relationships

.profile N:1 CardForCoinProfile

Referenced By (2 tables)

CurrentBalanceEvent N:1 .current_balance
BalanceChange N:1 .current_balance

Sample Queries (click to expand)

Get all records
CurrentBalance.objects.all()
Get by ID
CurrentBalance.objects.get(id=1)
With related CardForCoinProfile
CurrentBalance.objects.select_related("profile")

CurrentBalanceEvent

Table: fold_current_balance_event Extends: AccountEvent
Field Type Constraints
id BigAutoField PK
current_balance FK → CurrentBalance

Relationships

.current_balance N:1 CurrentBalance

Sample Queries (click to expand)

Get all records
CurrentBalanceEvent.objects.all()
Get by ID
CurrentBalanceEvent.objects.get(id=1)
With related CurrentBalance
CurrentBalanceEvent.objects.select_related("current_balance")

DefaultWithdrawAddress

Table: fold_default_withdraw_address Extends: CurrentBalanceEvent
Field Type Constraints
id BigAutoField PK
withdraw_address FK → WithdrawAddress nullable

Relationships

.withdraw_address N:1 WithdrawAddress

Sample Queries (click to expand)

Get all records
DefaultWithdrawAddress.objects.all()
Get by ID
DefaultWithdrawAddress.objects.get(id=1)
With related WithdrawAddress
DefaultWithdrawAddress.objects.select_related("withdraw_address")