+ Entity Relationship Diagram

Scroll to zoom Drag to pan Double-click to fit 100%
erDiagram BlackhawkVendorSource { string id PK string product_line_id int rate string upcs } Brand { string id PK int brand_parent FK string name string disclaimer_prefix string auto_generated_disclaimer_prefix } Brand }o--|| BrandParent : brand_parent Brand }o--o{ Tag : tags Brand }o--o{ Country : countries BrandFavorite { string id PK int account FK int brand FK } BrandFavorite }o--|| Account : account BrandFavorite }o--|| Brand : brand BrandParent { string id PK string name string generated_barcode_type string generated_barcode_data_format string number_formatter } BrandParent ||--|| BlackhawkVendorSource : blackhawk_vendor_source BrandParent ||--|| IncommVendorSource : incomm_vendor_source BrandParent ||--|| TilloVendorSource : tillo_vendor_source BrandParent ||--|| PineLabsVendorSource : pine_labs_vendor_source Country { string id PK } IncommVendorSource { string id PK string sku_prefix string product int rate string sku_variant } PineLabsVendorSource { string id PK string program_group_name int rate } Tag { string id PK string name string icon string description string image } TilloVendorSource { string id PK string slug }

BlackhawkVendorSource

Table: fold_blackhawk_vendor_source Extends: BaseModelMixin
Field Type Constraints
id BigAutoField PK
product_line_id CharField(255)
rate DecimalField(5,4)
upcs JSONField nullable

Referenced By (1 tables)

BrandParent 1:1 .blackhawk_vendor_source

Sample Queries (click to expand)

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

Brand

Table: brand
Field Type Constraints
id UUIDField PK default=uuid4
brand_parent FK → BrandParent
name TextField unique
disclaimer_prefix TextField default="" nullable
auto_generated_disclaimer_prefix TextField default=""
redemption_instructions TextField default=""
auto_generated_redemption_instructions_prefix TextField default=""
price_rate DecimalField(8,2) default=Decimal()
external_app_link TextField nullable
is_enabled BooleanField default=True
is_purchasable BooleanField default=False
allow_any_denomination BooleanField default=False
allowed_denominations JSONField default=list() nullable
is_instore BooleanField default=True
is_online BooleanField default=True
icon FileField
cover_icon FileField nullable
image_url URLField(500) nullable
tags M2M → Tag
countries M2M → Country
slug TextField
type SmallIntegerField choices default=GIFT_CARD()Show 2 choices
0GIFT_CARDgift_card
1FOLD_CARDfold_card
user_fold_card_purchase_caps JSONField default=dict() nullable
fold_card_accounts_only BooleanField default=False
available_payment_methods JSONField default=_default_available_payment_methods()
promotional_reward_rate_boost DecimalField(5,4) default=Decimal()
reward_rates JSONField

Relationships

.brand_parent N:1 BrandParent
.tags N:M Tag
.countries N:M Country

Referenced By (3 tables)

BrandFavorite N:1 .brand
Slot N:1 .brand
RefundPulled N:1 .brand

Sample Queries (click to expand)

Get all records
Brand.objects.all()
Get by ID
Brand.objects.get(id=1)
With related BrandParent
Brand.objects.select_related("brand_parent")

Schema History (click to expand)

#0609AlterField: reward_rates2025-07-18
#0609AlterField: user_fold_card_purchase_caps2025-07-18
#0610AlterField: brand_field2025-07-22
#0611AlterField: brand_field2025-07-24
#0613AddField: brand_parent2025-08-01
#0615AlterField: brand_field2025-08-01
#0630RemoveField: brand_field2025-08-08
#0630AlterField: brand_parent2025-08-08
#0652AddField: image_url2025-11-18
#0658AddField: cover_icon2025-12-30

BrandFavorite

Table: brand_favorite
Field Type Constraints
id BigAutoField PK
account FK → Account
brand FK → Brand

Relationships

.account N:1 Account
.brand N:1 Brand

Sample Queries (click to expand)

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

BrandParent

Table: fold_brand_parent Extends: BaseModelMixin
Field Type Constraints
id BigAutoField PK
name CharField(50) unique
generated_barcode_type CharField(50) nullable choicesShow 4 choices
code128Code128
code39Code39
qrcodeQR Code
pdf417PDF417
generated_barcode_data_format CharField(50) nullable choicesShow 5 choices
card_numberCard number only
event_number_card_numberEvent number + card number
card_number_event_numberCard number + event number
event_number_card_number_pinEvent number + card number + PIN
egift_card_number_event_numbereGift: + card number + event number
number_formatter CharField(50) nullable choicesShow 8 choices
card_and_pinCard # and PIN format
card_and_pin_format_4_spacesCard # with 4-space formatting and PIN
card_format_4_spacesCard # with 4-space formatting only
claim_codeClaim Code format
claim_code_and_pinClaim Code and PIN format
pin_onlyPIN only format
gift_code_and_cardGift Code and Card # format
card_and_pin_swappedCard # and PIN format but swapped
external_link_formatter CharField(50) nullable choicesShow 3 choices
append_card_numberAppend card number to base URL
amazonAmazon-specific encoding for redemption URLs
external_url_redemption_linkExternal redemption URL
blackhawk_vendor_source OneToOne → BlackhawkVendorSource nullable
incomm_vendor_source OneToOne → IncommVendorSource nullable
tillo_vendor_source OneToOne → TilloVendorSource nullable
pine_labs_vendor_source OneToOne → PineLabsVendorSource nullable

Relationships

.blackhawk_vendor_source 1:1 BlackhawkVendorSource
.incomm_vendor_source 1:1 IncommVendorSource
.tillo_vendor_source 1:1 TilloVendorSource
.pine_labs_vendor_source 1:1 PineLabsVendorSource

Referenced By (1 tables)

Brand N:1 .brand_parent

Sample Queries (click to expand)

Get all records
BrandParent.objects.all()
Get by ID
BrandParent.objects.get(id=1)
With related BlackhawkVendorSource
BrandParent.objects.select_related("blackhawk_vendor_source")

Country

Table: country
Field Type Constraints
id CharField(2) PK

Referenced By (1 tables)

Brand N:M .countries

Sample Queries (click to expand)

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

Schema History (click to expand)

#0001CreateModel2022-09-25

IncommVendorSource

Table: fold_incomm_vendor_source Extends: BaseModelMixin
Field Type Constraints
id BigAutoField PK
sku_prefix CharField(255)
product CharField(255) nullable
rate DecimalField(5,4)
sku_variant CharField(50) nullable

Referenced By (1 tables)

BrandParent 1:1 .incomm_vendor_source

Sample Queries (click to expand)

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

PineLabsVendorSource

Table: fold_pine_labs_vendor_source Extends: BaseModelMixin
Field Type Constraints
id BigAutoField PK
program_group_name CharField(255)
rate DecimalField(5,4)

Referenced By (1 tables)

BrandParent 1:1 .pine_labs_vendor_source

Sample Queries (click to expand)

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

Tag

Table: tag
Field Type Constraints
id UUIDField PK default=uuid4
name TextField unique
icon FileField
description TextField default=""
image FileField default=""
is_visible BooleanField default=True
index PositiveIntegerField

Referenced By (1 tables)

Brand N:M .tags

Sample Queries (click to expand)

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

Schema History (click to expand)

#0001CreateModel2022-09-25
#0001AlterField: image2022-09-25
#0422AlterField: description2023-10-31
#0422AlterField: icon2023-10-31
#0422AlterField: image2023-10-31

TilloVendorSource

Table: fold_tillo_vendor_source Extends: BaseModelMixin
Field Type Constraints
id BigAutoField PK
slug CharField(255)

Referenced By (1 tables)

BrandParent 1:1 .tillo_vendor_source

Sample Queries (click to expand)

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