Skip to main content

campaign

Table: campaign

The campaign table stores information about campaigns, including their timelines, eligibility criteria, and metadata for auditing.
It helps manage campaign lifecycles and track which users created or modified them.


Columns

Column NameData TypeConstraintsDescription
campaignIdint(11)NOT NULL, AUTO_INCREMENTUnique identifier for each campaign
namevarchar(50)UNIQUECampaign name (must be unique)
startDatedatetimeNULLCampaign start date and time
endDatedatetimeNULLCampaign end date and time
locationIdint(11)NULLIdentifier for campaign location
descriptionvarchar(300)NULLDetailed description of the campaign
createdByUserIdint(11)NULLUser who created the campaign
createdDatedatetimeNULLTimestamp when campaign was created
lastEditedByUserIdint(11)NULLUser who last modified the campaign
lastEditedDatedatetimeNULLTimestamp of last modification
voidedtinyint(1)DEFAULT 0Soft delete flag (0 = active, 1 = voided)
voidedDatedatetimeNULLTimestamp when campaign was voided
ageLimitLowerdoubleNULLMinimum eligible age for campaign
ageLimitUpperdoubleNULLMaximum eligible age for campaign

Indexes

  1. PRIMARY - Primary key on campaignId
  2. name - Unique index on name
  3. campaign_createdByUserId_user_mappedId_FK - Index on createdByUserId
  4. campaign_lastEditedByUserId_user_mappedId_FK - Index on lastEditedByUserId

Foreign Key Relations

  1. campaign_ibfk_1

    • Links createdByUserId to user.mappedId
    • Tracks which user created the campaign
  2. campaign_ibfk_2

    • Links lastEditedByUserId to user.mappedId
    • Tracks which user last edited the campaign

Usage Notes

  • Soft deletion is managed via the voided flag to preserve historical data.
  • Campaign names must be unique across the system.
  • Age limits (ageLimitLower and ageLimitUpper) define eligibility criteria.
  • Audit trail is maintained via createdByUserId, lastEditedByUserId, createdDate, and lastEditedDate.
  • Location references (locationId) link campaigns to specific geographic areas.