Skip to content

Database Reference

Full schema reference for the PS Workflow PostgreSQL database (hosted on Neon via Prisma). All tables use db push — there is no migrations history, only the current schema.


Entity Relationship Diagram


Core Tables

Deliverable

The central record for a single sponsored content piece. One row per deliverable — created by the PS team from a Monday.com item and progresses through stages until COMPLETE.

FieldTypeNotes
idIntPrimary key, auto-increment
mondayItemIdStringThe Monday.com item ID this deliverable maps to
deliverableNameStringFull name from Monday (e.g. "Caleb Hammer YouTube Integration for SoFi")
creatorNameStringParsed from the Monday item name
brandNameStringParsed from the Monday item name
stageDeliverableStageCurrent workflow stage — see Stage Enum below
brandEmailStringEffective email used for brand notifications (may be override in test mode)
creatorEmailStringEffective email used for creator notifications (may be override in test mode)
brandEmailOverrideString?Test-mode override email for brand
creatorEmailOverrideString?Test-mode override email for creator
brandEmailRealString?Actual fetched brand email (always stored, regardless of test mode)
creatorEmailRealString?Actual fetched creator email (always stored)
testModeBooleanIf true, test overrides are applied to all notifications
psPersonStringPS team member name (from Monday "Partnership Success" column)
agentStringAgent name (from Monday "Agent" column)
platformString?Content platform (from Monday "Platform" column) — e.g. "YouTube", "LinkedIn", "Newsletter"
payoutDateString?Payment date string from Monday's payout board
contractUrlString?Google Drive link to the Creator Agreement (fetched from Monday files)
adPositionString?Ad read position extracted from contract (async after creation)
modeString"normal" or "manual_intervention". Set to manual_intervention when PS needs to step in.
brandNoteString?PS-added note visible to creator on the form
talkingPointsLinkString?Google Docs link to brand brief (set by brand in WAITING_ON_TALKING_POINTS)
trackingLinkString?Affiliate/tracking URL from brand
descriptionTextString?Approved video caption — shown verbatim to creator at posting time
pinnedCommentTextString?Approved pinned comment text
adPlacementString?When in the video the sponsor segment should appear
brandAssetLinksString[]Array of links to brand logos, b-roll, graphics
otherRequirementsString?Additional posting requirements fetched from Monday at approval time
creatorCommChannelString?"email" or "slack" — from Airtable creator record
creatorSlackChannelIdString?Creator's Slack channel ID (for Slack-based creators)
creatorSlackUserIdString?Creator's Slack user ID
brandCommChannelString?"email" or "slack" — from Copper brand company record
brandSlackChannelIdString?Brand's Slack channel ID
brandSlackUserIdString?Brand's Slack user ID
brandPocNameString?Brand point-of-contact name (from Copper)
brandCcEmailsString[]Additional CC email addresses for brand communications
slackThreadTsString?Timestamp of the internal PS Slack logging thread for this deliverable
brandNotifSlackTsString?Timestamp of the most recent brand-facing Slack notification
creatorNotifSlackTsString?Timestamp of the most recent creator-facing Slack notification
notifiedBooleanWhether the initial talking points notification has been sent
batchIdString?UUID shared by deliverables created in the same batch operation
createdAtDateTime
updatedAtDateTime

DeliverableStage (Enum)

The seven stages a deliverable can be in, in order:

StageWho ActsDescription
WAITING_ON_TALKING_POINTSBrandBrand has not yet submitted their campaign brief
WAITING_FOR_SCRIPTCreatorCreator needs to submit their script
WAITING_FOR_SCRIPT_APPROVALBrandBrand is reviewing the submitted script
WAITING_FOR_VIDEO_DRAFTCreatorCreator needs to submit their video draft
WAITING_FOR_VIDEO_DRAFT_APPROVALBrandBrand is reviewing the video draft
WAITING_FOR_TALENT_TO_POSTCreatorAll approved — creator needs to post the video
COMPLETEVideo is live; brand and creator have been notified

Note: Organic Mention, LinkedIn, and Newsletter deliverables skip the video stages — they go from WAITING_FOR_SCRIPT_APPROVAL directly to WAITING_FOR_TALENT_TO_POST on script approval.


Submission

One row per creator submission round. A deliverable can have multiple submissions if the brand requests revisions (round increments on each re-submission).

FieldTypeNotes
idIntPrimary key
deliverableIdIntFK → Deliverable.id
typeString"script" or "video"
linkStringThe submitted Google Docs or video URL
statusString"unreviewed", "accepted", or "declined"
additionalNotesString?Brand's notes when accepting with conditions or declining
roundIntSubmission round number, starting at 1. Increments on each re-submission.
youtubeUrlString?Resolved YouTube URL after a direct upload completes in the background
createdAtDateTime
updatedAtDateTime

VideoComment

Timestamped comments left by the brand while reviewing a video draft. Stored per submission.

FieldTypeNotes
idIntPrimary key
submissionIdIntFK → Submission.id. Deletes cascade when submission is deleted.
timestampFloatVideo timestamp in seconds where the comment applies
textStringComment text
createdAtDateTime

A brand that has left any video comments is blocked from approving the video until comments are cleared — they must request revisions and consolidate feedback instead.


AccessToken

Secure, multi-use form access tokens. Generated for creators and brands so they can access their form without a login.

FieldTypeNotes
idIntPrimary key
tokenStringUnique token string embedded in the form URL. Unique index.
entityTypeString"creator" or "brand" — determines which deliverables are shown
entityNameStringThe creator or brand name. Used to filter deliverables.
testModeBooleanIf true, only shows deliverables with [testing] in the name
expiresAtDateTimeToken expiry (30 days from creation)
createdAtDateTime
lastUsedAtDateTime?Last time the token was used (updated on each form load)

Auth Tables

These tables are managed by BetterAuth and handle PS admin login.

user

PS admin accounts. Used to authenticate the admin panel.

FieldTypeNotes
idStringPrimary key
nameStringDisplay name
emailStringLogin email
emailVerifiedBooleanEmail verification status
imageString?Profile photo URL
createdAtDateTime
updatedAtDateTime

session

Active authenticated sessions for PS admin users.

FieldTypeNotes
idStringPrimary key
userIdStringFK → user.id
tokenStringSession token (unique)
expiresAtDateTimeSession expiry
ipAddressString?IP at sign-in time
userAgentString?Browser user agent
createdAtDateTime
updatedAtDateTime

account

OAuth provider account links associated with a user.

FieldTypeNotes
idStringPrimary key
accountIdStringProvider account ID
providerIdStringOAuth provider (e.g. "google")
userIdStringFK → user.id
accessTokenString?OAuth access token
refreshTokenString?OAuth refresh token
expiresAtDateTime?Access token expiry
createdAtDateTime
updatedAtDateTime

verification

Short-lived tokens for email verification / magic link flows.

FieldTypeNotes
idStringPrimary key
identifierStringEmail address being verified
valueStringOne-time token in the magic link
expiresAtDateTimeShort expiry window
createdAtDateTime?
updatedAtDateTime?