ad_campaigns table
The ad_campaigns table in the Reddit Clone Database Schema schema has 12 columns, keyed by id, with 1 foreign key to advertisers. 2 columns in ads and ad_targeting_rules reference it.
Budget and bid in minor units as integers. The pacing job reads (status, starts_at) and nothing else, which is why that index exists.
Columns (12)
| Column | Type | Constraints | Description |
|---|---|---|---|
| id | uuid | primary key | |
| advertiser_id | uuid | not null, references advertisers.id | |
| name | varchar(200) | not null | |
| objective | ad_objective | not null | |
| bid_type | ad_bid_type | not null | |
| bid_minor | integer | not null | |
| daily_budget_minor | integer | not null | |
| total_budget_minor | integer | ||
| currency | char(3) | not null | |
| status | ad_status | not null | |
| starts_at | timestamptz | not null | |
| ends_at | timestamptz |
Indexes (2)
(advertiser_id, status)(status, starts_at)
Relationships
ad_campaigns.advertiser_idreferencesadvertisers.idads.campaign_idreferencesad_campaignsad_targeting_rules.campaign_idreferencesad_campaigns