Skip to content

Database Schema

FluentAffiliate uses custom database tables (not WordPress post types). All tables are prefixed with fa_ in addition to the WordPress table prefix ($wpdb->prefix).

Table Inventory

TableDescription
fa_affiliatesRepresents a registered affiliate. Central model in FluentAffiliate.
fa_referralsRepresents a commission event generated when a referred visitor completes a qualifying action.
fa_payoutsA payout batch grouping multiple affiliate transactions.
fa_payout_transactionsAn individual payout transaction for a single affiliate within a payout batch.
fa_visitsTracks each click of an affiliate referral link.
fa_customersA customer who made a purchase through an affiliate link.
fa_metaGeneric key-value meta storage for affiliate and other objects.
fa_creativesA marketing creative asset (banner, image, or text) managed in FluentAffiliate Pro. PRO

Entity Relationships

fa_affiliates

Represents a registered affiliate. Central model in FluentAffiliate.

Model class: Affiliate

ColumnTypeNullableDefaultDescription
idBIGINT(20)NOPrimary key, auto-increment.
contact_idBIGINT(20)YESOptional FluentCRM contact ID linked to this affiliate.
user_idBIGINT(20)YESWordPress user ID of the affiliate.
group_idBIGINT(20)YESAffiliate group ID (Pro feature).
rateDOUBLEYESNULLCommission rate. Interpretation depends on rate_type.
total_earningsDOUBLEYES0Cumulative lifetime earnings (denormalised).
unpaid_earningsDOUBLEYES0Earnings not yet included in a paid payout.
referralsBIGINT(20)YES0Total referral count (denormalised).
visitsBIGINT(20)YES0Total visit count (denormalised).
lead_countsBIGINT(20)YES0Total lead count (denormalised).
rate_typeVARCHAR(100)YESpercentageCommission type — percentage or flat.
custom_paramVARCHAR(100)YESCustom URL parameter value used for tracking.
payment_emailVARCHAR(192)YESEmail address used for payout delivery.
statusVARCHAR(100)YESactiveRecord status.
settingsLONGTEXTYESSerialized JSON settings blob.
noteLONGTEXTYESInternal admin notes about the affiliate.
created_atTIMESTAMPYESTimestamp when the record was created.
updated_atTIMESTAMPYESTimestamp when the record was last updated.

fa_referrals

Represents a commission event generated when a referred visitor completes a qualifying action.

Model class: Referral

ColumnTypeNullableDefaultDescription
idBIGINT(20)NOPrimary key, auto-increment.
affiliate_idBIGINT(20)YESAffiliate who earned this referral.
parent_idBIGINT(20)YESParent referral ID (for multi-tier, reserved).
customer_idBIGINT(20)YESCustomer record associated with this purchase.
visit_idBIGINT(20)YESVisit that initiated this referral (if known).
descriptionLONGTEXTYESFree-text description.
statusVARCHAR(100)YESpendingRecord status.
amountDOUBLEYESNULLCommission amount earned by the affiliate.
order_totalDOUBLEYESNULLTotal order value that generated the referral.
currencyCHAR(3)YESISO 4217 currency code (e.g. USD).
utm_campaignVARCHAR(100)YESUTM campaign parameter from the tracking URL.
providerVARCHAR(100)YESIntegration slug that created this referral (e.g. woo, fluentcart).
provider_idBIGINT(20)YESProvider-specific order/payment numeric ID.
provider_sub_idVARCHAR(192)YESProvider-specific sub-ID (e.g. subscription ID).
productsLONGTEXTYESJSON list of product IDs in the order.
payout_transaction_idBIGINT(20)YESPayout transaction that included this referral.
payout_idBIGINT(20)YESParent payout record.
typeVARCHAR(100)YESsaleCreative type — image, text, html, banner.
settingsLONGTEXTYESSerialized JSON settings blob.
created_atTIMESTAMPYESTimestamp when the record was created.
updated_atTIMESTAMPYESTimestamp when the record was last updated.

fa_payouts

A payout batch grouping multiple affiliate transactions.

Model class: Payout

ColumnTypeNullableDefaultDescription
idBIGINT(20)NOPrimary key, auto-increment.
created_byBIGINT(20)YESWordPress user ID of the admin who created the payout.
total_amountDOUBLEYESNULLSum of all transactions in this payout.
payout_methodVARCHAR(100)YESmanualDelivery method — manual, paypal, etc.
statusVARCHAR(100)YESdraftRecord status.
currencyCHAR(3)YESISO 4217 currency code (e.g. USD).
titleVARCHAR(192)YESHuman-readable payout title.
descriptionLONGTEXTYESFree-text description.
settingsLONGTEXTYESSerialized JSON settings blob.
created_atTIMESTAMPYESTimestamp when the record was created.
updated_atTIMESTAMPYESTimestamp when the record was last updated.

fa_payout_transactions

An individual payout transaction for a single affiliate within a payout batch.

Model class: Transaction

ColumnTypeNullableDefaultDescription
idBIGINT(20)NOPrimary key, auto-increment.
created_byBIGINT(20)YESWordPress user ID of the admin who created the payout.
affiliate_idBIGINT(20)YESAffiliate who earned this referral.
payout_idBIGINT(20)YESParent payout record.
total_amountDOUBLEYES0Sum of all transactions in this payout.
payout_methodVARCHAR(100)YESmanualDelivery method — manual, paypal, etc.
statusVARCHAR(100)YESpaidRecord status.
currencyCHAR(3)YESISO 4217 currency code (e.g. USD).
settingsLONGTEXTYESSerialized JSON settings blob.
created_atTIMESTAMPYESTimestamp when the record was created.
updated_atTIMESTAMPYESTimestamp when the record was last updated.

fa_visits

Tracks each click of an affiliate referral link.

Model class: Visit

ColumnTypeNullableDefaultDescription
idBIGINT(20)NOPrimary key, auto-increment.
affiliate_idBIGINT(20)YESAffiliate who earned this referral.
user_idBIGINT(20)YESWordPress user ID of the affiliate.
referral_idBIGINT(20)YESReferral created from this visit (if any).
urlMEDIUMTEXTYESDestination URL linked from the creative.
referrerMEDIUMTEXTYESHTTP referer of the visit.
utm_campaignVARCHAR(100)YESUTM campaign parameter from the tracking URL.
utm_mediumVARCHAR(100)YESUTM medium parameter.
utm_sourceVARCHAR(100)YESUTM source parameter.
ipVARCHAR(100)YESHashed or raw visitor IP address.
created_atTIMESTAMPYESTimestamp when the record was created.
updated_atTIMESTAMPYESTimestamp when the record was last updated.

fa_customers

A customer who made a purchase through an affiliate link.

Model class: Customer

ColumnTypeNullableDefaultDescription
idBIGINT(20)NOPrimary key, auto-increment.
user_idBIGINT(20)YESWordPress user ID of the affiliate.
by_affiliate_idBIGINT(20)YESAffiliate who referred this customer.
emailVARCHAR(192)YESCustomer email address.
first_nameVARCHAR(192)YESCustomer first name.
last_nameVARCHAR(192)YESCustomer last name.
ipVARCHAR(100)YESHashed or raw visitor IP address.
settingsLONGTEXTYESSerialized JSON settings blob.
created_atTIMESTAMPYESTimestamp when the record was created.
updated_atTIMESTAMPYESTimestamp when the record was last updated.

fa_meta

Generic key-value meta storage for affiliate and other objects.

Model class: Meta

ColumnTypeNullableDefaultDescription
idBIGINTNOPrimary key, auto-increment.
object_typeVARCHAR(50)NOType of object this meta belongs to (e.g. affiliate).
object_idBIGINTYESID of the associated object.
meta_keyVARCHAR(192)NOMeta key.
valueLONGTEXTYESMeta value (serialized if complex).
created_atTIMESTAMPYESTimestamp when the record was created.
updated_atTIMESTAMPYESTimestamp when the record was last updated.

fa_creatives PRO

A marketing creative asset (banner, image, or text) managed in FluentAffiliate Pro.

Model class: Creative

ColumnTypeNullableDefaultDescription
idBIGINT(20)NOPrimary key, auto-increment.
nameVARCHAR(255)NOCreative asset name.
descriptionTEXTYESFree-text description.
typeVARCHAR(100)NOCreative type — image, text, html, banner.
imageTEXTYESURL of the creative image asset.
textTEXTYESText content for text-type creatives.
urlTEXTYESDestination URL linked from the creative.
privacyVARCHAR(100)YESpublicVisibility — public or private.
statusVARCHAR(100)YESactiveRecord status.
affiliate_idsJSONYESJSON array of affiliate IDs this creative is restricted to.
group_idsJSONYESJSON array of group IDs this creative is restricted to.
metaLONGTEXTYESAdditional metadata for the creative.
created_atTIMESTAMPYESTimestamp when the record was created.
updated_atTIMESTAMPYESTimestamp when the record was last updated.

Released under the GPL-2.0 License.