+ Entity Relationship Diagram

Scroll to zoom Drag to pan Double-click to fit 100%
erDiagram AdminRewardSats { string id PK string account_usernames int sats_amount string reason string comment } AdminRewardSats }o--|| User : admin_user AppNotification { string id PK string name datetime created string display_title string display_body } Device { string id PK string device_id datetime created datetime last_login string restriction } DeviceAppNotificationSettings { string id PK string device FK bool account_enabled bool deal_enabled bool spin_wheel_enabled } DeviceAppNotificationSettings ||--|| Device : device Feature { string id PK string name bool is_enabled_for_all datetime created string min_app_version } FeatureAccessCoupon { string id PK string code int feature FK int max_redemptions } FeatureAccessCoupon }o--|| Feature : feature SpreadTracker { string id PK string provider int purchase_amount int buy_price int sell_price }

AdminRewardSats

Table: fold_admin_reward_sats Extends: BaseModelMixin
Field Type Constraints
id BigAutoField PK
account_usernames TextField
sats_amount PositiveIntegerField
reason CharField(250) choicesAdminRewardSatsReason
comment TextField nullable
admin_user FK → User nullable

Relationships

.admin_user N:1 User

Sample Queries (click to expand)

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

AppNotification

Table: fold_appnotification
Field Type Constraints
id BigAutoField PK
name TextField nullable indexed
created DateTimeField
display_title TextField
display_body TextField
ttl PositiveIntegerField default=0
data JSONField nullable
deeplink_url JSONField nullable
is_bulk BooleanField default=False
priority TextField default="default"
error_details TextField nullable
push_provider TextField default=ITERABLE() choices nullableShow 1 choices
ITERABLEIterable

Referenced By (1 tables)

AppNotificationTarget N:1 .app_notification

Sample Queries (click to expand)

Get all records
AppNotification.objects.all()
Get by ID
AppNotification.objects.get(id=1)
Filter by created (last 7 days)
AppNotification.objects.filter(created__gte=datetime.now()-timedelta(days=7))

Device

Table: fold_device
Field Type Constraints
id BigAutoField PK
device_id CharField(40) unique
created DateTimeField
last_login DateTimeField default=now
restriction CharField(20) choices nullableShow 1 choices
NO_ACCOUNT_CREATIONNo Account Creation

Referenced By (3 tables)

AccountDevice N:1 .device

Sample Queries (click to expand)

Get all records
Device.objects.all()
Get by ID
Device.objects.get(id=1)
Filter by created (last 7 days)
Device.objects.filter(created__gte=datetime.now()-timedelta(days=7))

Schema History (click to expand)

#0001CreateModel2022-09-25
#0001AlterField: device_id2022-09-25

DeviceAppNotificationSettings

Table: fold_deviceappnotificationsettings
Field Type Constraints
id BigAutoField PK
device OneToOne → Device
account_enabled BooleanField nullable
deal_enabled BooleanField nullable
spin_wheel_enabled BooleanField nullable
transaction_enabled BooleanField default=True

Relationships

.device 1:1 Device

Sample Queries (click to expand)

Get all records
DeviceAppNotificationSettings.objects.all()
Get by ID
DeviceAppNotificationSettings.objects.get(id=1)
With related Device
DeviceAppNotificationSettings.objects.select_related("device")

Feature

Table: fold_feature
Field Type Constraints
id BigAutoField PK
name CharField(50) unique
is_enabled_for_all BooleanField default=False
created DateTimeField
min_app_version CharField(100) nullable

Referenced By (3 tables)

FeatureAccessCoupon N:1 .feature
Account N:M .account_enabled_features
WhatsNewCard N:M .show_if_has_features

Sample Queries (click to expand)

Get all records
Feature.objects.all()
Get by ID
Feature.objects.get(id=1)
Filter by created (last 7 days)
Feature.objects.filter(created__gte=datetime.now()-timedelta(days=7))

Schema History (click to expand)

#0001CreateModel2022-09-25
#0280AddField: min_app_version2022-11-15

FeatureAccessCoupon

Table: fold_feature_access_coupon
Field Type Constraints
id BigAutoField PK
code CharField(100) unique
feature FK → Feature
max_redemptions PositiveIntegerField default=1

Relationships

.feature N:1 Feature

Referenced By (1 tables)

FeatureAccessCouponRedemption N:1 .feature_access_coupon

Sample Queries (click to expand)

Get all records
FeatureAccessCoupon.objects.all()
Get by ID
FeatureAccessCoupon.objects.get(id=1)
With related Feature
FeatureAccessCoupon.objects.select_related("feature")

SpreadTracker

Table: fold_spread_tracker Extends: BaseModelMixin
Field Type Constraints
id BigAutoField PK
provider CharField(250) choicesPricingProviders
purchase_amount DecimalField(10,2) nullable
buy_price DecimalField(10,2)
sell_price DecimalField(10,2)
spread_bps DecimalField(10,2)

Sample Queries (click to expand)

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