Skip to main content

Overview

The Trending Society database contains 127 custom tables plus 37 Supabase-managed tables (164 total), organized across 3 schemas. Project: trendingsociety-production Project Ref: ymdccxqzmhxgbjbppywf Schema Version: 015 Last Updated: 2025-12-25
SchemaTablesPurposeAccess
public111Product data, user contentRLS required
system14Infrastructure, API keysservice_role only
events1Immutable audit logsappend-only
Multi-Tenant Status: 42/127 tables have tenant_id column. Source: agents/schema/SCHEMA.md

Table Index

system.circuit_breakers

API resilience with automatic recovery.
ColumnTypeDescription
iduuidPrimary key
service_nametextUnique service identifier
failure_countintegerCurrent failure count
is_openbooleanCircuit is open (blocking requests)
last_failuretimestamptzLast failure timestamp
last_successtimestamptzLast success timestamp
opened_attimestamptzWhen circuit opened
last_errortextLast error message
last_error_codetextHTTP status or error code
thresholdintegerFailures before opening (default: 5)
cooldown_secondsintegerWait before retry (default: 60)
created_attimestamptzRow created
updated_attimestamptzRow updated

system.checkpoints

Workflow state for resumable processing.
ColumnTypeDescription
iduuidPrimary key
workflow_nametextUnique workflow identifier
last_processed_idtextLast successfully processed ID
last_processed_attimestamptzWhen last item was processed
items_processedintegerTotal items in current run
current_run_idtextUUID for current execution
statustext’running’, ‘completed’, ‘failed’, ‘paused’
started_attimestamptzCurrent run started
completed_attimestamptzCurrent run completed
error_messagetextError if failed
retry_countintegerRetry attempts
metadatajsonbWorkflow-specific state
created_attimestamptzRow created
updated_attimestamptzRow updated

system.ai_usage

Token and cost tracking for near-zero optimization.
ColumnTypeDescription
iduuidPrimary key
tasktextTask type (classify, extract, generate, etc.)
workflow_nametextParent workflow
execution_idtextSpecific execution
providertext’openai’, ‘anthropic’, ‘google’
modeltextSpecific model name
input_tokensintegerInput tokens used
output_tokensintegerOutput tokens used
total_tokensintegerTotal tokens
estimated_costnumeric(10,6)Cost in USD (6 decimal places)
content_iduuidRelated content if applicable
record_typetext’content’, ‘audience’, ‘generation’
latency_msintegerResponse time
created_attimestamptzRow created

system.ai_model_config

Model routing for cost optimization.
ColumnTypeDescription
iduuidPrimary key
task_typetext’classify’, ‘extract’, ‘generate’, ‘vision’, ‘embed’, ‘reason’
providertext’google’, ‘openai’, ‘anthropic’
model_nametextFull model identifier
api_endpointtextAPI URL
cost_per_1m_inputnumericCost per 1M input tokens
cost_per_1m_outputnumericCost per 1M output tokens
max_tokensintegerMax output tokens
requests_per_minuteintegerRate limit
tokens_per_minuteintegerToken rate limit
fallback_modelsjsonbArray of fallback model configs
supports_visionbooleanCan process images
supports_json_modebooleanStructured output
supports_streamingbooleanStreaming responses
is_activebooleanCurrently enabled
created_attimestamptzRow created
updated_attimestamptzRow updated

system.state_history

Audit trail for all state transitions.
ColumnTypeDescription
iduuidPrimary key
table_nametextSource table
record_iduuidRecord that changed
old_statetextPrevious state value
new_statetextNew state value
changed_byuuidUser/system that made change
change_reasontextWhy the change occurred
metadatajsonbAdditional context
created_attimestamptzWhen change occurred

system.api_keys

Encrypted API key storage.
ColumnTypeDescription
iduuidPrimary key
service_nametextService identifier
key_nametextKey identifier (e.g., ‘primary’, ‘backup’)
encrypted_valuetextEncrypted key value
expires_attimestamptzExpiration date
last_rotated_attimestamptzLast rotation
is_activebooleanCurrently active
created_attimestamptzRow created
updated_attimestamptzRow updated

system.ai_pricing

AI model pricing per token for cost optimization.
ColumnTypeDescription
iduuidPrimary key
providertext’openai’, ‘anthropic’, ‘google’
model_nametextFull model identifier
input_cost_centsintegerCost per 1M input tokens in cents
output_cost_centsintegerCost per 1M output tokens in cents
context_windowintegerMax context tokens
max_output_tokensintegerMax output tokens
supports_visionbooleanImage input support
supports_function_callingbooleanTool use support
supports_json_modebooleanStructured output
latency_tiertext’fast’, ‘medium’, ‘slow’
quality_tiertext’basic’, ‘standard’, ‘premium’
is_activebooleanCurrently enabled
deprecated_attimestamptzDeprecation date
effective_fromtimestamptzWhen pricing took effect
created_attimestamptzRow created
updated_attimestamptzRow updated

system.tenant_automations

Per-tenant automation subscriptions. Cron jobs query this to run automations for enabled tenants.
ColumnTypeDescription
iduuidPrimary key
tenant_idtextTenant identifier (‘trendingsociety’, ‘golfinsider’)
automation_keytextAutomation type (‘social_post’, ‘order_sync’)
automation_nametextHuman-readable name
automation_descriptiontextDescription for UI
configjsonbAutomation-specific settings
credentials_reftextReference to vault credentials
cron_overridetextCustom cron expression (null = use default)
timezonetextTenant’s timezone (default: UTC)
enabledbooleanIs automation active?
paused_attimestamptzWhen manually paused
paused_reasontextWhy paused
last_run_attimestamptzLast execution time
last_run_statustext’success’, ‘failure’, ‘skipped’
last_run_duration_msintegerExecution duration
last_errortextLast error message
run_countintegerTotal successful runs
error_countintegerTotal failed runs
tiertext’free’, ‘standard’, ‘premium’
monthly_price_centsintegerPrice if selling as product
created_attimestamptzRow created
updated_attimestamptzRow updated

system.automation_registry

Master list of available automations (product catalog for multi-tenant platform).
ColumnTypeDescription
iduuidPrimary key
automation_keytextUnique automation identifier
nametextDisplay name
descriptiontextDescription for UI
categorytext’content’, ‘ecommerce’, ‘reporting’
default_crontextDefault cron expression
default_timezonetextDefault timezone
required_credentialstext[]Required credential types
required_config_fieldsjsonbSchema for config validation
available_tierstext[]Available subscription tiers
tier_pricingjsonbPricing per tier in cents
is_activebooleanAvailable for subscription
is_betabooleanBeta feature flag
created_attimestamptzRow created
updated_attimestamptzRow updated

system.automation_runs

Audit log of all automation executions.
ColumnTypeDescription
iduuidPrimary key
tenant_automation_iduuidFK to tenant_automations
tenant_idtextTenant identifier
automation_keytextAutomation type
started_attimestamptzExecution start
finished_attimestamptzExecution end
duration_msintegerExecution duration
statustext’running’, ‘success’, ‘failure’, ‘skipped’
items_processedintegerTotal items processed
items_succeededintegerSuccessful items
items_failedintegerFailed items
error_messagetextError if failed
error_stacktextStack trace
trigger_typetext’cron’, ‘manual’, ‘webhook’
execution_contextjsonbAdditional metadata

events.outbox

Transactional outbox for async event processing (Stripe/Uber/Meta pattern).
ColumnTypeDescription
iduuidPrimary key
aggregate_typetextEntity that generated event (e.g., publisher_post)
aggregate_iduuidEntity ID
event_typetextWhat happened: created, updated, published
payloadjsonbFull event data
tenant_iduuidMulti-tenant scope (NULL for system)
actor_iduuidWho caused this (user, system, webhook)
correlation_iduuidDistributed trace ID
occurred_attimestamptzWhen business event happened
enqueued_attimestamptzWhen inserted to outbox
processed_attimestamptzNULL = pending, timestamp = delivered
retry_countintegerDelivery attempts
last_errortextMost recent delivery error
sequence_numberbigintMonotonic ordering key

content_sources

Multi-platform scraping configuration.
ColumnTypeDescription
iduuidPrimary key
platformtext’instagram’, ‘tiktok’, ‘youtube’, ‘twitter’, ‘reddit’, ‘rss’
source_typetext’profile’, ‘hashtag’, ‘location’, ‘feed’, ‘channel’
identifiertextUsername, hashtag, URL, etc.
display_nametextHuman-readable name
profile_urltextLink to source
avatar_urltextProfile image
followers_countintegerFollower count
posts_countintegerTotal posts
is_verifiedbooleanPlatform verified
scrape_frequencytext’hourly’, ‘daily’, ‘weekly’
apify_actor_idtextApify actor for this source
scrape_configjsonbActor-specific settings
last_scraped_attimestamptzLast scrape time
next_scrape_attimestamptzScheduled next scrape
consecutive_failuresintegerFailures since last success
avg_yield_ratenumericAvg new items per scrape
avg_quality_scorenumericAvg content quality
degraded_attimestamptzWhen quality dropped
auto_disabled_attimestamptzWhen auto-disabled
vertical_iduuidFK → publisher_verticals
trust_scoreinteger0-100 source reliability
is_activebooleanCurrently active
created_attimestamptzRow created
updated_attimestamptzRow updated

source_scrape_logs

Quality scoring per scrape run.
ColumnTypeDescription
iduuidPrimary key
source_iduuidFK → content_sources
run_idtextApify run ID
items_foundintegerRaw items discovered
items_newintegerNew items (not duplicates)
items_processedintegerSuccessfully processed
yield_ratenumericitems_new / items_found
quality_scorenumericAvg content quality
apify_costnumericApify credit cost
duration_secondsintegerScrape duration
error_messagetextError if failed
created_attimestamptzScrape timestamp

raw_content

Platform-agnostic normalized storage.
ColumnTypeDescription
iduuidPrimary key
source_iduuidFK → content_sources
platformtextOrigin platform
platform_content_idtextPlatform’s unique ID
original_urltextPermalink
shortcodetextPlatform shortcode (Instagram)
content_typetext’image’, ‘video’, ‘carousel’, ‘reel’, ‘story’
titletextTitle if available
captiontextFull caption text
descriptiontextExtended description
hashtagstext[]Extracted hashtags
mentionstext[]@mentions
media_urltextOriginal media URL
thumbnail_urltextThumbnail URL
cloudinary_urltextBacked up media
cloudinary_public_idtextCloudinary asset ID
cloudinary_thumbnail_urltextBacked up thumbnail
duration_secondsnumericVideo duration
widthintegerMedia width
heightintegerMedia height
aspect_ratiotext’1:1’, ‘4:5’, ‘9:16’, ‘16:9’
likes_countintegerLike count
comments_countintegerComment count
shares_countintegerShare count
views_countintegerView count
saves_countintegerSave count
engagement_ratenumericEngagement / reach
virality_scorenumericShares / views
platform_metadatajsonbPlatform-specific data
statustext’pending’, ‘analyzed’, ‘ready’, ‘archived’
published_attimestamptzOriginal publish date
scraped_attimestamptzWhen scraped
tenant_iduuidFK → tenants (multi-tenant isolation)
created_attimestamptzRow created
updated_attimestamptzRow updated
text_embeddingvector(1536)OpenAI text-embedding-3-small for caption/description
visual_embeddingvector(1536)Visual content embedding (Cloudinary AI/CLIP)
combined_embeddingvector(1536)Weighted fusion (0.3 text + 0.7 visual for video)
embedding_modeltextModel used for embeddings
embedded_attimestamptzWhen embeddings were generated

content_analysis

Comprehensive AI analysis extracted ONCE, cached forever.
ColumnTypeDescription
iduuidPrimary key
content_iduuidFK → raw_content
content_hashtextHash for deduplication
scene_descriptiontextAI-generated scene description
objects_detectedtext[]Objects in frame
dominant_colorsjsonb[{color: “#fff”, percent: 40}]
composition_typetext’centered’, ‘rule_of_thirds’, ‘symmetrical’
lighting_styletext’natural’, ‘studio’, ‘golden_hour’, ‘low_key’
setting_typetext’indoor’, ‘outdoor’, ‘studio’
has_facebooleanFace detected
face_countintegerNumber of faces
primary_emotiontextDominant facial emotion
has_text_overlaybooleanText on image
text_in_imagetextOCR extracted text
has_musicbooleanBackground music
music_energytext’calm’, ‘moderate’, ‘high_energy’
music_genretextDetected genre
is_trending_soundbooleanPlatform trending audio
sound_idtextPlatform sound identifier
has_voiceoverbooleanVoiceover narration
has_speechbooleanAny speech detected
transcripttextFull transcript
speaking_pacetext’slow’, ‘moderate’, ‘fast’
language_detectedtextISO language code
hook_typetext’question’, ‘statement’, ‘visual’, ‘curiosity_gap’
hook_texttextFirst 3 seconds text
hook_strengthinteger0-100 hook effectiveness
cta_presentbooleanCall to action exists
cta_typetext’follow’, ‘comment’, ‘link’, ‘buy’
cta_texttextCTA text
content_categorytextPrimary category
content_formattext’tutorial’, ‘review’, ‘vlog’, ‘meme’, ‘news’
topicstext[]Topic tags
entitiesjsonbNamed entities
tonetext’educational’, ‘entertaining’, ‘inspirational’
reading_leveltext’simple’, ‘moderate’, ‘advanced’
word_countintegerCaption word count
sentimenttext’positive’, ‘neutral’, ‘negative’
sentiment_scorenumeric-1.0 to 1.0
visual_embeddingvector(768)Image embedding
text_embeddingvector(768)Text embedding
combined_embeddingvector(768)Fused embedding
extracted_factsjsonbStructured facts for prompt injection
analyzed_attimestamptzAnalysis timestamp
analysis_versiontextVersion identifier
model_usedtextAI model used
analysis_tokensintegerTokens consumed
analysis_costnumericCost in USD

platforms

Publishing destinations with requirements.
ColumnTypeDescription
iduuidPrimary key
nametextUnique identifier (‘tiktok’, ‘instagram_reels’)
display_nametextHuman-readable name
supported_typestext[][‘video’, ‘image’, ‘carousel’]
min_duration_secondsintegerMinimum video length
max_duration_secondsintegerMaximum video length
aspect_ratiostext[][‘9:16’, ‘1:1’, ‘4:5’]
max_caption_lengthintegerCharacter limit
max_hashtagsintegerHashtag limit
allows_linksbooleanLinks in caption
max_file_size_mbintegerUpload limit
supported_formatstext[][‘mp4’, ‘mov’]
has_apibooleanAPI available
api_supports_schedulingbooleanCan schedule posts
api_supports_analyticsbooleanCan pull analytics
audience_typetext’gen_z’, ‘millennial’, ‘professional’
content_velocitytext’high’, ‘medium’, ‘low’
algorithm_favorstext[][‘trending_audio’, ‘original_content’, ‘engagement’]
peak_hoursjsonbBest posting times
time_zonetextDefault timezone
avg_engagement_ratenumericPlatform average
total_postsintegerOur posts on platform
algorithm_notestextPlatform-specific notes
best_practicestextGuidelines
is_activebooleanCurrently publishing
created_attimestamptzRow created
updated_attimestamptzRow updated

platform_patterns

What works WHERE - the core prediction engine.
ColumnTypeDescription
iduuidPrimary key
pattern_nametextHuman-readable name
pattern_typetext’format’, ‘topic’, ‘hook’, ‘timing’, ‘audio’
pattern_descriptiontextWhat this pattern represents
pattern_criteriajsonbMatching rules (see below)
platform_iduuidFK → platforms
sample_sizeintegerData points
avg_viewsintegerAverage views for pattern
avg_likesintegerAverage likes
avg_commentsintegerAverage comments
avg_sharesintegerAverage shares
avg_engagement_ratenumericAverage engagement
avg_retention_ratenumericAverage retention
avg_share_ratenumericAverage share rate
lift_vs_platform_avgnumericTHE MAGIC NUMBER
confidence_scorenumeric0-1 based on sample_size
best_daystext[][‘Monday’, ‘Thursday’]
best_hoursinteger[][9, 12, 18]
seasonal_trendsjsonbSeasonal variations
last_calculated_attimestamptzLast recalculation
created_attimestamptzRow created
updated_attimestamptzRow updated

content_platform_scores

AI prediction for each content + platform combination.
ColumnTypeDescription
iduuidPrimary key
content_iduuidFK → raw_content (or content_analysis)
platform_iduuidFK → platforms
fit_scoreinteger0-100 overall fit
fit_reasoningtextWhy this score
matched_patternsjsonbPatterns that matched with lifts
total_pattern_liftnumericCombined lift
adaptations_neededjsonbRequired changes
adaptation_difficultytext’none’, ‘easy’, ‘moderate’, ‘complex’
adaptation_cost_estimatenumericEstimated cost
predicted_views_lowintegerConservative estimate
predicted_views_midintegerExpected estimate
predicted_views_highintegerOptimistic estimate
predicted_engagement_ratenumericExpected engagement
predicted_virality_scorenumericExpected virality
recommended_post_timetimestamptzBest time to post
recommended_daytextBest day
recommended_actiontextDecision output
scored_attimestamptzWhen scored
scoring_model_versiontextModel version
created_attimestamptzRow created
updated_attimestamptzRow updated

content_templates

Reusable generation patterns.
ColumnTypeDescription
iduuidPrimary key
nametextTemplate name
output_typetext’article’, ‘caption’, ‘script’, ‘email’
target_platform_iduuidFK → platforms
system_prompttextSystem instructions
user_prompt_templatetextTemplate with {{placeholders}}
available_placeholdersjsonbDocumented placeholders
model_nametextDefault model
temperaturenumericDefault temperature
max_tokensintegerDefault max tokens
target_word_countintegerTarget length
target_duration_secondsintegerTarget duration
required_sectionstext[]Must-have sections
times_usedintegerUsage count
avg_performance_scorenumericAverage performance
is_activebooleanCurrently active
created_attimestamptzRow created
updated_attimestamptzRow updated

generated_content

AI-created content ready for distribution.
ColumnTypeDescription
iduuidPrimary key
source_content_iduuidFK → raw_content
source_analysis_iduuidFK → content_analysis
template_iduuidFK → content_templates
voice_profile_iduuidFK → voice_profiles
target_platform_iduuidFK → platforms
pattern_idsuuid[]Matched patterns
adaptations_appliedjsonbWhat was changed
output_typetext’article’, ‘video’, ‘caption’
titletextGenerated title
bodytextFull body text
captiontextSocial caption
hashtagstext[]Generated hashtags
ctatextCall to action
meta_descriptiontextSEO description
target_keywordtextSEO keyword
scripttextVideo script
script_word_countintegerWord count
estimated_duration_secondsnumericEstimated length
emotion_markersjsonb[{time: 0, emotion: “excited”}]
scene_markersjsonb[{time: 0, scene: “intro”}]
content_urltextPrimary content URL
thumbnail_urltextThumbnail URL
preview_urltextPreview URL
video_urltextVideo URL
audio_urltextAudio URL
llm_providertextLLM provider used
llm_modeltextModel used
llm_input_tokensintegerInput tokens
llm_output_tokensintegerOutput tokens
llm_costnumericLLM cost
avatar_providertextAvatar provider
avatar_video_idtextAvatar video ID
avatar_costnumericAvatar cost
voice_providertextVoice provider
voice_audio_idtextVoice audio ID
voice_costnumericVoice cost
cloudinary_costnumericStorage/transform cost
total_generation_costnumericTotal cost
statustext’draft’, ‘generating’, ‘ready’, ‘approved’, ‘published’, ‘failed’
ai_quality_scoreintegerAI quality assessment
human_approvedbooleanHuman approved
approved_byuuidFK → users
approved_attimestamptzApproval time
error_messagetextError if failed
retry_countintegerRetry attempts
created_attimestamptzRow created
updated_attimestamptzRow updated
experiment_iduuidFK → content_experiments (if part of A/B test)
experiment_varianttext’A’ (control), ‘B’, ‘C’, ‘D’
generation_cost_usdnumeric(10,6)Total cost to generate this content
generation_breakdownjsonbStep-by-step cost breakdown
models_usedtext[]All models used in generation
total_tokensintegerTotal tokens consumed
latency_msintegerTotal generation time
generation_started_attimestamptzWhen generation began
generation_completed_attimestamptzWhen generation completed

pattern_feedback

Connect performance back to patterns for learning.
ColumnTypeDescription
iduuidPrimary key
content_platform_score_iduuidFK → content_platform_scores
pattern_iduuidFK → platform_patterns
distribution_iduuidFK → distributions
predicted_viewsintegerWhat we predicted
actual_viewsintegerWhat happened
views_error_percentnumericPrediction error
predicted_engagement_ratenumericPredicted engagement
actual_engagement_ratenumericActual engagement
engagement_error_percentnumericEngagement error
pattern_contributedbooleanPattern helped success
expected_liftnumericExpected lift
actual_liftnumericActual lift
processedbooleanBatch processed
processed_attimestamptzProcessing time
created_attimestamptzRow created

content_experiments

A/B test configuration for content generation.
ColumnTypeDescription
iduuidPrimary key
nametextExperiment name
hypothesistextWhat we’re testing
experiment_typetext’template’, ‘voice’, ‘format’, ‘timing’, ‘headline’, ‘cta’, ‘image_style’
control_template_iduuidFK → content_templates (control)
control_voice_iduuidFK → voice_profiles (control)
variantsjsonbVariant configs with traffic percentages
target_platformsuuid[]Platforms to test on (NULL = all)
target_verticalsuuid[]Verticals to test on (NULL = all)
metric_primarytextPrimary metric to optimize
metric_secondarytext[]Secondary metrics to track
confidence_thresholdnumericRequired confidence (0.80-0.99)
minimum_sample_sizeintegerMin samples per variant
statustext’draft’, ‘running’, ‘paused’, ‘completed’, ‘cancelled’
winner_variant_idtextWinning variant (‘A’, ‘B’, etc.)
winning_lift_percentnumericWinner’s lift vs control
winning_confidencenumericStatistical confidence
started_attimestamptzTest start time
ended_attimestamptzTest end time
auto_end_on_significancebooleanAuto-complete when significant
max_duration_daysintegerMax test duration
created_byuuidFK → auth.users
created_attimestamptzRow created
updated_attimestamptzRow updated

content_experiment_results

Daily computed statistics per variant.
ColumnTypeDescription
iduuidPrimary key
experiment_iduuidFK → content_experiments
variant_idtext’A’, ‘B’, ‘C’, ‘D’
computed_attimestamptzWhen computed
sample_sizeintegerNumber of samples
metric_meannumericMean value
metric_mediannumericMedian value
metric_stddevnumericStandard deviation
metric_ci_lowernumeric95% CI lower bound
metric_ci_uppernumeric95% CI upper bound
lift_percentnumericLift vs control
p_valuenumericStatistical p-value
is_significantbooleanMeets confidence threshold
secondary_metricsjsonbOther tracked metrics

aiv_bot_domains

Domains registered for AI bot tracking.
ColumnTypeDescription
iduuidPrimary key
tenant_iduuidFK → tenants (required)
domaintextDomain name (e.g., ‘example.com’)
script_tokentextUnique token for tracking script
is_activebooleanCurrently tracking
verification_methodtext’dns’, ‘meta_tag’, ‘file’
verified_attimestamptzWhen domain was verified
settingsjsonbDomain-specific settings
created_attimestamptzRow created
updated_attimestamptzRow updated

aiv_bot_events

Individual bot crawl events detected on your site.
ColumnTypeDescription
iduuidPrimary key
domain_iduuidFK → aiv_bot_domains
tenant_iduuidFK → tenants
bot_nametextBot identifier (‘GPTBot’, ‘ClaudeBot’)
bot_companytextCompany (‘OpenAI’, ‘Anthropic’, ‘Google’)
is_verified_botbooleanVerified via reverse DNS
page_urltextFull URL crawled
page_pathtextPath portion of URL
page_titletextPage title if available
content_lengthintegerResponse size in bytes
content_hashtextHash for deduplication
user_agenttextFull user agent string
ip_addressinetBot IP address
country_codetextISO country code
citytextCity from IP geolocation
crawled_attimestamptzWhen crawl occurred
metadatajsonbAdditional event data
created_attimestamptzRow created

aiv_bot_geo_scores

GEO (Generative Engine Optimization) scores per page.
ColumnTypeDescription
iduuidPrimary key
domain_iduuidFK → aiv_bot_domains
tenant_iduuidFK → tenants
page_urltextFull URL analyzed
page_pathtextPath portion of URL
overall_scoreinteger0-100 overall GEO score
schema_scoreintegerStructured data quality
semantic_scoreintegerContent semantic clarity
readability_scoreintegerReading ease score
entity_scoreintegerNamed entity recognition
freshness_scoreintegerContent freshness
schema_typestext[]Schema.org types found
issuesjsonbDetected issues
recommendationsjsonbImprovement suggestions
content_hashtextHash for change detection
analyzed_attimestamptzWhen analysis ran
created_attimestamptzRow created
updated_attimestamptzRow updated

aiv_bot_alerts

Alert configuration for bot activity thresholds.
ColumnTypeDescription
iduuidPrimary key
domain_iduuidFK → aiv_bot_domains
tenant_iduuidFK → tenants
alert_typetext’bot_activity’, ‘geo_score_drop’, etc.
channeltext’email’, ‘slack’, ‘webhook’
configjsonbChannel-specific config
thresholdjsonbTrigger thresholds
enabledbooleanAlert is active
trigger_countintegerTimes triggered
last_triggered_attimestamptzLast trigger time
created_attimestamptzRow created
updated_attimestamptzRow updated

aiv_bot_google_aio

Google AI Overview (SGE) appearances for your content.
ColumnTypeDescription
iduuidPrimary key
domain_iduuidFK → aiv_bot_domains
tenant_iduuidFK → tenants
querytextSearch query that triggered AIO
query_hashtextHash for deduplication
positionintegerPosition in AIO sources (1 = first)
cited_urltextYour URL that was cited
cited_pathtextPath portion of cited URL
snippettextText shown in AIO
search_locationtextGeographic location of search
detected_attimestamptzWhen detected
metadatajsonbAdditional data
created_attimestamptzRow created

aiv_cite_platforms

AI platforms we track for citations.
ColumnTypeDescription
iduuidPrimary key
nametextPlatform key (‘chatgpt’, ‘perplexity’, etc.)
display_nametextHuman-readable name
detection_methodtext’api’, ‘scrape’, ‘extension’, ‘referrer’, ‘manual’
api_availablebooleanHas API access
api_endpointtextAPI URL if available
scrape_allowedbooleanCan scrape results
icon_urltextPlatform icon
color_hextextBrand color
market_share_percentnumericEstimated market share
is_activebooleanCurrently tracking
created_attimestamptzRow created
updated_attimestamptzRow updated

aiv_cite_events

Individual citation events when AI references your content.
ColumnTypeDescription
iduuidPrimary key
domain_iduuidFK → aiv_bot_domains (for unified tracking)
tenant_iduuidMulti-tenant isolation
vertical_iduuidVertical for filtering
content_iduuidFK → generated_content
distribution_iduuidFK → distributions
publisher_post_iduuidFK → publisher_posts
cited_urltextURL that was cited (required)
cited_domaintextDomain for grouping
platform_iduuidFK → aiv_cite_platforms
platform_nametextDenormalized platform name (required)
query_texttextUser’s query (if known)
query_categorytext’informational’, ‘navigational’, ‘transactional’, ‘commercial’
query_intenttext’how_to’, ‘what_is’, ‘comparison’, ‘recommendation’, ‘news’
citation_typetext’source_link’, ‘inline_quote’, ‘reference’, ‘knowledge_panel’, ‘featured’
citation_positioninteger1 = first source (lower is better)
citation_snippettextText shown to user
total_sources_shownintegerTotal sources in response
detected_attimestamptzWhen detected
detection_methodtextDetection method (required): ‘browser_extension’, ‘api_monitor’, ‘manual_entry’
detection_sourcetextTool/user that reported
confidence_scorenumeric0-1 confidence
screenshot_urltextEvidence screenshot
raw_response_jsonjsonbFull AI response
response_hashtextHash for deduplication
template_iduuidFK → content_templates (attribution)
voice_profile_iduuidFK → voice_profiles (attribution)
experiment_iduuidFK → content_experiments
experiment_varianttextA/B variant if applicable
created_attimestamptzRow created

aiv_cite_daily_stats

Pre-aggregated statistics for dashboard performance.
ColumnTypeDescription
iduuidPrimary key
datedateStats date
tenant_iduuidOptional tenant filter
vertical_iduuidOptional vertical filter
platform_nametextOptional platform filter
template_iduuidOptional template filter
total_citationsintegerTotal citations
unique_urls_citedintegerUnique URLs cited
unique_queriesintegerUnique queries
avg_citation_positionnumericAverage position
position_1_countintegerTimes ranked #1
position_top3_countintegerTimes in top 3
position_top5_countintegerTimes in top 5
source_link_countintegerSource link citations
inline_quote_countintegerInline quote citations
featured_countintegerFeatured citations
citations_prev_periodintegerPrevious period count
citations_change_percentnumericPeriod-over-period change
computed_attimestamptzWhen computed

aiv_cite_target_queries

Queries you want to rank for (like SEO keywords but for AEO).
ColumnTypeDescription
iduuidPrimary key
query_texttextThe query to track
query_categorytextQuery type
tenant_iduuidMulti-tenant isolation
vertical_iduuidFK → publisher_verticals
target_platformtext’all’ or specific platform
prioritytext’high’, ‘medium’, ‘low’
is_activebooleanCurrently monitoring
current_positionintegerLast known position
current_platform_positionsjsonbPer-platform positions
best_positionintegerBest ever achieved
best_position_attimestamptzWhen best was achieved
check_frequencytext’hourly’, ‘daily’, ‘weekly’
last_checked_attimestamptzLast check time
next_check_attimestamptzNext scheduled check
created_byuuidFK → auth.users
created_attimestamptzRow created
updated_attimestamptzRow updated

aiv_cite_query_rankings

Time series of your ranking position for target queries.
ColumnTypeDescription
iduuidPrimary key
target_query_iduuidFK → aiv_cite_target_queries
platform_nametextPlatform checked
positionintegerYour position (NULL = not found)
our_urltextWhich URL ranked
total_sourcesintegerTotal sources shown
checked_attimestamptzWhen checked
check_methodtext’api’, ‘scrape’, ‘manual’
response_snippettextRaw response text
all_sourcesjsonbAll sources in response

audience_profiles

Cross-platform user identity (Amazon/Netflix-style).
ColumnTypeDescription
iduuidPrimary key
emailtextEmail address
phonetextPhone number
user_iduuidFK → users (if registered)
platform_identitiesjsonb{instagram: “handle”, tiktok: “id”}
first_nametextFirst name
last_nametextLast name
avatar_urltextProfile image
company_nametextCompany
company_domaintextCompany domain
company_sizetext’solo’, ‘smb’, ‘mid-market’, ‘enterprise’
company_industrytextIndustry
company_revenue_rangetextRevenue bracket
job_titletextJob title
job_leveltext’ic’, ‘manager’, ‘director’, ‘vp’, ‘c-level’
job_functiontextFunction area
geo_citytextCity
geo_statetextState/Province
geo_countrytextCountry
timezonetextTimezone
device_typetext’mobile’, ‘desktop’, ‘tablet’
device_value_scoreintegerApple = high WTP
browsertextBrowser
first_seen_attimestamptzFirst interaction
last_active_attimestamptzLast interaction
total_sessionsintegerSession count
total_page_viewsintegerPage views
total_content_viewsintegerContent views
avg_session_duration_secondsnumericAvg session length
peak_activity_hoursinteger[]Most active hours
peak_activity_daystext[]Most active days
favorite_topicstext[]Preferred topics
favorite_content_typestext[]Preferred formats
favorite_formatstext[]Preferred formats
preferred_platformstext[]Preferred platforms
wtp_scoreintegerWillingness to pay (0-100)
wtp_breakdownjsonbScore breakdown by factor
lead_scoreintegerLead quality (0-100)
lead_tiertext’cold’, ‘warm’, ‘hot’, ‘qualified’
engagement_scoreintegerEngagement level (0-100)
churn_risk_scoreintegerChurn risk (0-100)
lifecycle_stagetext’anonymous’, ‘known’, ‘subscriber’, ‘lead’, ‘customer’, ‘churned’
became_subscriber_attimestamptzSubscription date
became_lead_attimestamptzLead date
became_customer_attimestamptzCustomer date
churned_attimestamptzChurn date
micro_segment_iduuidFK → micro_segments
segment_assigned_attimestamptzAssignment date
predicted_ltvnumericPredicted lifetime value
conversion_probabilitynumericConversion likelihood
next_action_predictiontextPredicted next action
price_tiertext’budget’, ‘standard’, ‘premium’
recommended_pricenumericPersonalized price
personalization_enabledbooleanPersonalization active
created_attimestamptzRow created
updated_attimestamptzRow updated

audience_events

Event sourcing for full attribution.
ColumnTypeDescription
iduuidPrimary key
audience_iduuidFK → audience_profiles
event_typetext’page_view’, ‘content_view’, ‘click’, ‘form_submit’, ‘purchase’
event_categorytextCategory
event_actiontextAction
event_labeltextLabel
session_idtextSession identifier
page_urltextPage URL
page_titletextPage title
referrer_urltextReferrer
referrer_domaintextReferrer domain
utm_sourcetextUTM source
utm_mediumtextUTM medium
utm_campaigntextUTM campaign
utm_termtextUTM term
utm_contenttextUTM content
content_iduuidFK → generated_content
distribution_iduuidFK → distributions
platformtextSource platform
vertical_iduuidFK → publisher_verticals
post_iduuidFK → publisher_posts
video_percent_watchedintegerVideo progress
video_seconds_watchednumericWatch time
event_valuenumericEvent value
currencytextCurrency code
device_typetextDevice
browsertextBrowser
ostextOperating system
ip_addressinetIP address
geo_citytextCity
geo_countrytextCountry
lead_score_deltaintegerScore change
wtp_score_deltaintegerWTP change
metadatajsonbAdditional data
created_attimestamptzEvent time

micro_segments

Netflix-style behavioral clusters.
ColumnTypeDescription
iduuidPrimary key
segment_idtextUnique identifier
segment_nametextHuman name
segment_descriptiontextDescription
characteristicsjsonbDefining characteristics
defining_traitstext[]Key traits
recommended_content_typestext[]Best content
recommended_topicstext[]Best topics
recommended_offertextBest offer type
recommended_messagingtextBest messaging
avg_wtp_scoreintegerAverage WTP
price_tiertextPrice tier
price_multipliernumeric0.6x - 1.4x base price
user_countintegerUsers in segment
avg_conversion_ratenumericConversion rate
avg_ltvnumericAverage LTV
avg_engagement_scorenumericEngagement
cluster_algorithmtextAlgorithm used
feature_weightsjsonbFeature importance
last_recalculated_attimestamptzLast update
created_attimestamptzRow created
updated_attimestamptzRow updated

wtp_scoring_rules

Configuration for WTP calculation.
ColumnTypeDescription
iduuidPrimary key
rule_nametextRule name
rule_categorytext’device’, ‘geo’, ‘behavior’, ‘firmographic’
criteriajsonbMatching criteria
score_deltaintegerPoints to add/subtract
priorityintegerRule priority
rationaletextWhy this rule
is_activebooleanCurrently active
created_attimestamptzRow created

voice_profiles

Brand voice configuration.
ColumnTypeDescription
iduuidPrimary key
nametextProfile name
brand_nametextBrand this voice represents
brand_descriptiontextBrand context
target_audiencetextWho we’re talking to
tonetext[][‘friendly’, ‘professional’, ‘witty’]
styletext[][‘conversational’, ‘authoritative’]
avoidtext[][‘jargon’, ‘emojis’, ‘exclamation_marks’]
max_sentence_lengthintegerWord limit per sentence
preferred_word_count_minintegerMin output length
preferred_word_count_maxintegerMax output length
use_contractionsbooleanUse contractions
example_goodtext[]Good examples
example_badtext[]Bad examples
avatar_presentertextDefault avatar
avatar_backgroundtextDefault background
avatar_outfittextDefault outfit
elevenlabs_voice_idtextElevenLabs voice
voice_stabilitynumericVoice setting
voice_similaritynumericVoice setting
voice_stylenumericVoice setting
d_id_presenter_idtextD-ID presenter
d_id_driver_idtextD-ID driver
heygen_avatar_idtextHeyGen avatar
vertical_iduuidFK → publisher_verticals
is_defaultbooleanDefault for vertical
created_attimestamptzRow created
updated_attimestamptzRow updated

distributions

Track every publication.
ColumnTypeDescription
iduuidPrimary key
content_iduuidFK → generated_content
platform_iduuidFK → platforms
platform_post_idtextPlatform’s post ID
published_urltextLive URL
caption_usedtextActual caption posted
hashtags_usedtext[]Actual hashtags
scheduled_attimestamptzScheduled time
published_attimestamptzActual publish time
varianttextA/B test variant (‘A’, ‘B’)
test_iduuidA/B test identifier
test_hypothesistextWhat we’re testing
predicted_viewsintegerSnapshot of prediction
predicted_engagement_ratenumericSnapshot of prediction
statustext’scheduled’, ‘published’, ‘failed’, ‘deleted’
error_messagetextError if failed
buffer_post_idtextBuffer integration
buffer_schedule_idtextBuffer schedule
created_attimestamptzRow created
updated_attimestamptzRow updated

distribution_metrics

Time-series performance tracking.
ColumnTypeDescription
iduuidPrimary key
distribution_iduuidFK → distributions
viewsintegerViews at snapshot
likesintegerLikes at snapshot
commentsintegerComments at snapshot
sharesintegerShares at snapshot
savesintegerSaves at snapshot
clicksintegerClicks at snapshot
engagement_ratenumeric(5,4)Engagement rate
virality_scorenumeric(5,2)Virality score
share_ratenumeric(5,4)Share rate
retention_ratenumeric(5,4)Video retention
retention_curvejsonb[{second: 1, percent: 100}]
avg_watch_time_secondsnumeric(6,2)Average watch time
prediction_error_percentnumeric(5,2)How wrong we were
attributed_clicksintegerRevenue clicks
attributed_revenuenumeric(12,2)Revenue attributed
hours_since_publishintegerHours since publish
snapshot_typetext’scheduled’, ‘manual’, ‘final’
created_attimestamptzSnapshot time

ad_components

Meta-style component assembly for A/B testing.
ColumnTypeDescription
iduuidPrimary key
component_typetext’headline’, ‘cta’, ‘image’, ‘video’, ‘body’
target_segment_iduuidFK → micro_segments
contenttextComponent content
image_urltextImage if applicable
impressionsintegerImpressions
clicksintegerClicks
conversionsintegerConversions
ctrnumericClick-through rate
variant_nametextA/B variant name
is_activebooleanCurrently active
created_attimestamptzRow created
updated_attimestamptzRow updated

publisher_verticals

ColumnTypeDescription
iduuidPrimary key
nametextVertical name
slugtextURL slug
descriptiontextDescription
subdomaintextSubdomain (tech, golf, travel)
primary_colortextBrand color
secondary_colortextSecondary color
logo_urltextLogo
is_activebooleanActive
created_attimestamptzRow created
updated_attimestamptzRow updated

publisher_post_analytics

See database or Supabase dashboard for complete column definitions.
Full column definitions available in Supabase dashboard.

publisher_post_tags

See database or Supabase dashboard for complete column definitions.
Full column definitions available in Supabase dashboard.

publisher_post_viator_products

See database or Supabase dashboard for complete column definitions.
Full column definitions available in Supabase dashboard.

publisher_posts

Platform (UCI - Universal Creative Income)

ColumnTypeDescription
iduuidPrimary key
vertical_iduuidFK → publisher_verticals
source_content_iduuidFK → raw_content
generated_content_iduuidFK → generated_content
titletextPost title
slugtextURL slug
excerpttextPreview text
bodytextFull content
featured_image_urltextFeatured image
statustext’draft’, ‘scheduled’, ‘published’
published_attimestamptzPublish date
meta_titletextSEO title
meta_descriptiontextSEO description
target_keywordtextSEO keyword
author_iduuidFK → users
created_attimestamptzRow created
updated_attimestamptzRow updated

creator_profiles

See database or Supabase dashboard for complete column definitions.
Full column definitions available in Supabase dashboard.

creator_licenses

See database or Supabase dashboard for complete column definitions.
Full column definitions available in Supabase dashboard.

creator_license_purchases

See database or Supabase dashboard for complete column definitions.
Full column definitions available in Supabase dashboard.

creator_payouts

See database or Supabase dashboard for complete column definitions.
Full column definitions available in Supabase dashboard.

agency_clients

See database or Supabase dashboard for complete column definitions.
Full column definitions available in Supabase dashboard.

agency_projects

See database or Supabase dashboard for complete column definitions.
Full column definitions available in Supabase dashboard.

agency_deliverables

See database or Supabase dashboard for complete column definitions.
Full column definitions available in Supabase dashboard.

agency_retainers

See database or Supabase dashboard for complete column definitions.
Full column definitions available in Supabase dashboard.

shopify_customers

See database or Supabase dashboard for complete column definitions.
Full column definitions available in Supabase dashboard.

shopify_products

See database or Supabase dashboard for complete column definitions.
Full column definitions available in Supabase dashboard.

shopify_orders

See database or Supabase dashboard for complete column definitions.
Full column definitions available in Supabase dashboard.

service_order_projects

See database or Supabase dashboard for complete column definitions.
Full column definitions available in Supabase dashboard.

This documentation is auto-generated from agents/schema/SCHEMA.md. Run pnpm docs:sync-schema to update.