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)

Columns of the ad_campaigns table
ColumnTypeConstraintsDescription
iduuidprimary key
advertiser_iduuidnot null, references advertisers.id
namevarchar(200)not null
objectivead_objectivenot null
bid_typead_bid_typenot null
bid_minorintegernot null
daily_budget_minorintegernot null
total_budget_minorinteger
currencychar(3)not null
statusad_statusnot null
starts_attimestamptznot null
ends_attimestamptz

Indexes (2)

  • (advertiser_id, status)
  • (status, starts_at)

Relationships