Orochia
Documentation
GitHub
Pour les développeurs

Every table, column, index, foreign key and enum of the PostgreSQL schema, with the relationship diagram — generated from the Drizzle schema.

Database Reference

Generated from packages/db/src/schema by scripts/generate-docs.mjs — do not hand-edit. To change the schema: edit it, npm run db:generate, review the SQL, npm run db:migrate — see the Development guide.

PostgreSQL 16 · 23 tables · 14 enums · 2 migrations (packages/db/drizzle).

Relationships

Tables

audience_list_members

ColumnTypeNullDefaultNotes
iduuidnogen_random_uuid()primary key
list_iduuidno→ audience_lists.id (on delete cascade)
user_iduuidno→ users.id (on delete cascade)
created_attimestamp with time zonenonow()

Indexes: audience_list_members_unique_idx (unique, list_id, user_id) · audience_list_members_user_idx (user_id)

audience_lists

ColumnTypeNullDefaultNotes
iduuidnogen_random_uuid()primary key
owner_iduuidno→ users.id (on delete cascade)
namevarchar(80)no
created_attimestamp with time zonenonow()
updated_attimestamp with time zonenonow()

Indexes: audience_lists_owner_name_idx (unique, owner_id, name)

auth_tokens

ColumnTypeNullDefaultNotes
iduuidnogen_random_uuid()primary key
user_iduuidno→ users.id (on delete cascade)
purposeauth_token_purposeno
token_hashvarchar(64)no
expires_attimestamp with time zoneno
used_attimestamp with time zoneyes
created_attimestamp with time zonenonow()

Indexes: auth_tokens_hash_idx (unique, token_hash) · auth_tokens_user_purpose_idx (user_id, purpose)

compliance_reports

ColumnTypeNullDefaultNotes
iduuidnogen_random_uuid()primary key
video_iduuidyes→ videos.id (on delete set null)
video_titlevarchar(255)no
reasonreport_reasonno
detailstextno
reporter_emailvarchar(255)no
reporter_iduuidyes→ users.id (on delete set null)
statusreport_statusno"OPEN"
created_attimestamp with time zonenonow()
resolved_attimestamp with time zoneyes

Indexes: compliance_reports_status_idx (status, created_at)

contacts

ColumnTypeNullDefaultNotes
iduuidnogen_random_uuid()primary key
requester_iduuidno→ users.id (on delete cascade)
addressee_iduuidno→ users.id (on delete cascade)
statuscontact_statusno"PENDING"
created_attimestamp with time zonenonow()
updated_attimestamp with time zonenonow()

Indexes: contacts_pair_idx (unique, requester_id, addressee_id)

follows

ColumnTypeNullDefaultNotes
iduuidnogen_random_uuid()primary key
follower_iduuidno→ users.id (on delete cascade)
creator_iduuidno→ users.id (on delete cascade)
statusfollow_statusno"PENDING"
created_attimestamp with time zonenonow()
decided_attimestamp with time zoneyes

Indexes: follows_pair_idx (unique, follower_id, creator_id) · follows_creator_status_idx (creator_id, status)

payment_intents

ColumnTypeNullDefaultNotes
iduuidnogen_random_uuid()primary key
gatewaypayment_gatewayno
gateway_session_idvarchar(255)yes
sender_iduuidyes→ users.id (on delete set null)
creator_iduuidno→ users.id (on delete cascade)
video_iduuidyes→ videos.id (on delete set null)
amount_centsintegerno
currencyvarchar(3)no"USD"
statuspayment_intent_statusno"PENDING"
gateway_transaction_refvarchar(255)yes
ledger_iduuidyes
created_attimestamp with time zonenonow()
updated_attimestamp with time zonenonow()

Indexes: payment_intents_sender_idx (sender_id) · payment_intents_status_idx (status)

payout_requests

ColumnTypeNullDefaultNotes
iduuidnogen_random_uuid()primary key
creator_iduuidno→ users.id (on delete cascade)
amount_centsintegerno
statuspayout_statusno"REQUESTED"
payout_methodvarchar(50)no
payout_destinationtextno
tx_hash_or_referencetextyes
failure_reasontextyes
reviewed_attimestamp with time zoneyes
settled_attimestamp with time zoneyes
created_attimestamp with time zonenonow()
updated_attimestamp with time zonenonow()

Indexes: payout_requests_creator_status_idx (creator_id, status)

playlist_audience_lists

ColumnTypeNullDefaultNotes
iduuidnogen_random_uuid()primary key
playlist_iduuidno→ playlists.id (on delete cascade)
list_iduuidno→ audience_lists.id (on delete cascade)
created_attimestamp with time zonenonow()

Indexes: playlist_audience_lists_unique_idx (unique, playlist_id, list_id) · playlist_audience_lists_list_idx (list_id)

playlist_items

ColumnTypeNullDefaultNotes
iduuidnogen_random_uuid()primary key
playlist_iduuidno→ playlists.id (on delete cascade)
video_iduuidno→ videos.id (on delete cascade)
positionintegerno0
created_attimestamp with time zonenonow()

Indexes: playlist_items_position_idx (playlist_id, position) · playlist_video_unique_idx (unique, playlist_id, video_id)

playlist_members

ColumnTypeNullDefaultNotes
iduuidnogen_random_uuid()primary key
playlist_iduuidno→ playlists.id (on delete cascade)
user_iduuidno→ users.id (on delete cascade)
created_attimestamp with time zonenonow()

Indexes: playlist_members_unique_idx (unique, playlist_id, user_id) · playlist_members_user_idx (user_id)

playlists

ColumnTypeNullDefaultNotes
iduuidnogen_random_uuid()primary key
creator_iduuidno→ users.id (on delete cascade)
titlevarchar(255)no
descriptiontextyes
visibilitycollection_visibilityno"PRIVATE"
created_attimestamp with time zonenonow()
updated_attimestamp with time zonenonow()

Indexes: playlists_creator_idx (creator_id)

profiles

ColumnTypeNullDefaultNotes
iduuidnogen_random_uuid()primary key
user_iduuidnounique · → users.id (on delete cascade)
display_namevarchar(100)yes
biotextyes
avatar_urltextyes
banner_urltextyes
website_urltextyes
twitter_handlevarchar(100)yes
min_tip_amount_centsintegerno500
payout_address_cryptotextyes
payout_account_ccbillvarchar(100)yes
total_viewsintegerno0
total_tips_earned_centsintegerno0
updated_attimestamp with time zonenonow()

tips_ledger

ColumnTypeNullDefaultNotes
iduuidnogen_random_uuid()primary key
entry_typeledger_entry_typeno
sender_iduuidyes→ users.id (on delete set null)
creator_iduuidno→ users.id (on delete cascade)
video_iduuidyes→ videos.id (on delete set null)
gross_amount_centsintegerno
platform_fee_centsintegerno0
net_amount_centsintegerno
gatewaypayment_gatewayno
gateway_transaction_refvarchar(255)no
notetextyes
created_attimestamp with time zonenonow()

Indexes: tips_ledger_creator_idx (creator_id) · tips_ledger_sender_idx (sender_id) · tips_ledger_video_idx (video_id) · tips_ledger_created_at_idx (created_at) · tips_ledger_credit_once_idx (unique, gateway, gateway_transaction_ref, partial)

users

ColumnTypeNullDefaultNotes
iduuidnogen_random_uuid()primary key
emailvarchar(255)nounique
usernamevarchar(50)nounique
password_hashtextno
roleuser_roleno"MEMBER"
is_verifiedbooleannofalse
is_age_verifiedbooleannofalse
email_verified_attimestamp with time zoneyes
suspended_attimestamp with time zoneyes
suspension_reasontextyes
created_attimestamp with time zonenonow()
updated_attimestamp with time zonenonow()

video_access_grants

ColumnTypeNullDefaultNotes
iduuidnogen_random_uuid()primary key
video_iduuidno→ videos.id (on delete cascade)
user_iduuidno→ users.id (on delete cascade)
granted_viavarchar(50)no"TIP_PAYMENT"
amount_paid_centsintegerno
transaction_reftextno
created_attimestamp with time zonenonow()

Indexes: video_access_user_idx (unique, video_id, user_id)

video_audience_lists

ColumnTypeNullDefaultNotes
iduuidnogen_random_uuid()primary key
video_iduuidno→ videos.id (on delete cascade)
list_iduuidno→ audience_lists.id (on delete cascade)
created_attimestamp with time zonenonow()

Indexes: video_audience_lists_unique_idx (unique, video_id, list_id) · video_audience_lists_list_idx (list_id)

video_comments

ColumnTypeNullDefaultNotes
iduuidnogen_random_uuid()primary key
video_iduuidno→ videos.id (on delete cascade)
author_iduuidno→ users.id (on delete cascade)
parent_iduuidyes→ video_comments.id (on delete cascade)
bodytextno
created_attimestamp with time zonenonow()
edited_attimestamp with time zoneyes
removed_attimestamp with time zoneyes
removed_byuuidyes→ users.id (on delete set null)

Indexes: video_comments_video_created_idx (video_id, created_at) · video_comments_parent_idx (parent_id)

video_likes

ColumnTypeNullDefaultNotes
iduuidnogen_random_uuid()primary key
video_iduuidno→ videos.id (on delete cascade)
user_iduuidno→ users.id (on delete cascade)
created_attimestamp with time zonenonow()

Indexes: video_likes_once_idx (unique, video_id, user_id) · video_likes_user_idx (user_id)

video_shares

ColumnTypeNullDefaultNotes
iduuidnogen_random_uuid()primary key
video_iduuidno→ videos.id (on delete cascade)
user_iduuidyes→ users.id (on delete set null)
channelshare_channelno"LINK"
created_attimestamp with time zonenonow()

Indexes: video_shares_video_idx (video_id)

video_viewers

ColumnTypeNullDefaultNotes
iduuidnogen_random_uuid()primary key
video_iduuidno→ videos.id (on delete cascade)
user_iduuidno→ users.id (on delete cascade)
created_attimestamp with time zonenonow()

Indexes: video_viewers_unique_idx (unique, video_id, user_id) · video_viewers_user_idx (user_id)

video_views

ColumnTypeNullDefaultNotes
iduuidnogen_random_uuid()primary key
video_iduuidno→ videos.id (on delete cascade)
viewer_iduuidyes→ users.id (on delete set null)
viewer_keyvarchar(80)no
viewed_ondatenonow()
created_attimestamp with time zonenonow()

Indexes: video_views_once_per_day_idx (unique, video_id, viewer_key, viewed_on) · video_views_video_day_idx (video_id, viewed_on)

videos

ColumnTypeNullDefaultNotes
iduuidnogen_random_uuid()primary key
creator_iduuidno→ users.id (on delete cascade)
bunny_video_idvarchar(120)nounique
titlevarchar(255)no
descriptiontextyes
visibilityvideo_visibilityno"PUBLIC"
statusvideo_statusno"PENDING_UPLOAD"
min_tip_amount_centsintegerno0
duration_secondsintegerno0
thumbnail_urltextyes
preview_animation_urltextyes
views_countintegerno0
tips_countintegerno0
likes_countintegerno0
comments_countintegerno0
shares_countintegerno0
comments_enabledbooleannotrue
resolutionstext[]yes
tagstext[]yes
removed_attimestamp with time zoneyes
removal_reasontextyes
created_attimestamp with time zonenonow()
updated_attimestamp with time zonenonow()

Indexes: videos_creator_idx (creator_id) · videos_visibility_idx (visibility) · videos_status_idx (status) · videos_created_at_idx (created_at)

Enums

EnumValues
auth_token_purposeVERIFY_EMAIL, RESET_PASSWORD
collection_visibilityPUBLIC, APPROVED_FOLLOWERS_ONLY, CONTACTS_ONLY, INVITED_ONLY, PRIVATE
contact_statusPENDING, ACCEPTED, REJECTED, BLOCKED
follow_statusPENDING, APPROVED
ledger_entry_typeTIP_RECEIVED, PLATFORM_FEE, CREATOR_CREDIT, PAYOUT_REQUESTED, PAYOUT_COMPLETED, REFUND
payment_gatewayCCBILL, SEGPAY, CRYPTO, STRIPE
payment_intent_statusPENDING, SUCCEEDED, FAILED
payout_statusREQUESTED, UNDER_REVIEW, PROCESSING, SETTLED, FAILED
report_reasonNON_CONSENSUAL, UNDERAGE, DMCA_COPYRIGHT, TERMS_VIOLATION, FRAUD_SCAM
report_statusOPEN, IN_REVIEW, RESOLVED
share_channelLINK, X, WHATSAPP, TELEGRAM, EMAIL, OTHER
user_roleADMIN, CREATOR, MEMBER
video_statusPENDING_UPLOAD, PROCESSING, READY, FAILED
video_visibilityPUBLIC, CONTACTS_ONLY, APPROVED_FOLLOWERS_ONLY, TIPPED_UNLOCKED, INVITED_ONLY

Migrations

  • 0000_initial_schema.sql
  • 0001_email_verification_and_password_reset.sql