Skip to content

Database Tables

132 tables discovered across supabase/migrations/ (210 migration files). "Defined in" is the first migration that creates the table; later migrations may alter it. Descriptions come from COMMENT ON TABLE. See Database architecture.

TableDefined inDescription
ad_placements20260406092809_remote_schema.sqlDefines available ad slots across the application.
ad_rules20260406092809_remote_schema.sqlDefines where, when, and how an ad is displayed.
ad_special_users20260406092809_remote_schema.sqlWhitelist of users for special ad viewing modes (Advertiser, Reviewer).
admin_task_reminders20260406092809_remote_schema.sql
ads20260406092809_remote_schema.sqlStores individual ad creatives and their metadata.
broker_accounts20260406092809_remote_schema.sqlDetails of user-linked broker accounts, including capital and name.
community_posts20260406092809_remote_schema.sqlContains user-generated posts for the community feed, including text, tags, and engagement counts.
daily_psychology_checkins20260503_051_psychology_checkins_table.sql
daily_scheduled_clean_up_tables_list20260406092809_remote_schema.sqlConfiguration table for daily automated database cleanup via Edge Function. Admins manage table cleanup settings here.
direct_messages20260406092809_remote_schema.sql
edge_function_configs20260406092809_remote_schema.sqlStores configurations for Supabase Edge Functions, like API keys or parameters.
edge_function_runs20260511_085_edge_function_monitoring.sqlPersistent execution log for instrumented Supabase Edge Functions. Each row = one completed invocation. Written by the EF at job completion using the service-role client. Feeds the Edge Functions Monitoring Dashboard.
feature_flags20260406092809_remote_schema.sql
finfluencify_announcement_recipients20260406092809_remote_schema.sqlTracks read status per student per announcement. Enables read rate calculation, unread tracking, and engagement metrics.
finfluencify_announcements20260406092809_remote_schema.sqlMain announcements table for broadcasting messages to students. Tracks read status, priority, and notification delivery methods.
finfluencify_certificate_templates20260408_finfluencify_certificate_templates.sqlPlatform-managed certificate HTML templates. Trainers pick one per course.
finfluencify_commission_brackets20260409_004_finfluencify_commission_brackets.sqlPrice-range commission rules. Level 2 in the 4-tier commission resolution hierarchy —
finfluencify_course_analytics20260406092809_remote_schema.sqlDaily analytics fact table. Aggregated course metrics for dashboard reporting and trend analysis. One record per course per day. Used for performance reporting and business analytics.
finfluencify_course_batches20260406092809_remote_schema.sqlBatch cohorts table. Groups students into time-bound batches for cohort-based courses. Each batch has separate start/end dates and capacity limits. Supports live session scheduling.
finfluencify_course_enrollments20260406092809_remote_schema.sqlStudent enrollments table. Central table for student-course relationships. Tracks payment status, access grants, and progress. Free courses: access_granted immediately. Paid courses: student submits payment ID, trainer verifies and grants access.
finfluencify_course_inquiries20260406092809_remote_schema.sqlPre-enrollment leads table. Captures inquiries from prospects before they enroll. Tracks follow-up communication and conversion status. Used for CRM-style lead management. Unregistered users can inquire about courses.
finfluencify_course_lesson_progress20260406092809_remote_schema.sqlPer-lesson progress table. Fine-grained progress tracking for each student-lesson combination. Stores video watch duration, quiz scores, assignment status, etc.
finfluencify_course_lessons20260406092809_remote_schema.sqlIndividual lessons table. Stores individual lessons within modules. Supports multiple content types: video, document, quiz, assignment, live-session. Tracks progress metrics for each lesson.
finfluencify_course_modules20260406092809_remote_schema.sqlCourse structure/sections table. Organizes courses into logical modules/sections. Each module contains multiple lessons. Supports drag-drop reordering via position field.
finfluencify_course_payment_verifications20260406092809_remote_schema.sqlPayment verification table. Tracks student payment submissions and trainer verification. Core to Payment ID workflow: (1) Student pays via trainer link, (2) Student submits payment ID to platform, (3) Trainer verifies in gateway, (4) Trainer grants access. Decouples payment processing from platform.
finfluencify_course_promotions20260406092809_remote_schema.sqlCourse promotion codes table. Course-specific coupon codes for trainer-run campaigns. Tracks usage per course and enforces quota limits. Independent from plan-wide offers.
finfluencify_course_reviews_and_ratings20260406092809_remote_schema.sqlCourse reviews table. Stores course reviews and ratings from enrolled students. Can be moderated by admins. Ratings feed into course's avg_rating metric (updated by trigger).
finfluencify_courses20260406092809_remote_schema.sqlCore course metadata table. Stores all information about courses including pricing, approval workflow, SEBI compliance, and analytics. Single course record per trainer. Key features: Approval workflow tracking (draft → review → approved → published), SEBI compliance flags, multiple pricing models, soft deletion via status field.
finfluencify_discount_codes20260409_002_finfluencify_discount_codes.sqlTrainer-managed discount/coupon codes. Validated server-side by the payment initiation function. Students have no direct access to this table.
finfluencify_email_outbox20260703_165_finfluencify_email_outbox.sqlDurable retryable outbox for live-class transactional email (+ .ics). Lifecycle EFs enqueue; finfluencify-email-outbox-sweep drains to ZeptoMail with bounded backoff and a dead-letter terminal state. Service-role only (RLS: no policies).
finfluencify_engagement_metrics20260406092809_remote_schema.sqlDaily engagement aggregation per course. Used for dashboard reporting and trend analysis over time.
finfluencify_enquiry_submissions20260406092809_remote_schema.sqlVisitor lead capture submissions from trainer public pages (/:slug). Rate-limit the INSERT endpoint to prevent spam. Visitor PII is scoped to the trainer owning that slug — RLS prevents cross-trainer reads. Consider CAPTCHA (Cloudflare Turnstile) in Phase 3.
finfluencify_lesson_qa20260409_001_finfluencify_lesson_qa.sqlSingle-level threaded Q&A for course lessons. parent_id = NULL for top-level questions, non-NULL for replies.
finfluencify_link_in_bio20260406092809_remote_schema.sqlFinFluencify Link-in-Bio editable config. One row per trainer. Created on first page save after slug claim. All mutable UI state is JSONB to avoid schema changes for minor fields. theme: slug-format regex only — no fixed IN-list so new theme packs never need a migration. Free: dark|light|soft-pink|forest|ocean|midnight. Premium: gradient-sunset|gradient-aurora|gradient-ocean|gradient-midnight| gradient-neon|glassmorphism|neon-glow|carbon. Fully-custom: "custom". accent_color: named token (orange|blue|green|purple|red|pink|teal|gold) OR any valid CSS 3/6-digit hex string (e.g. #FF6B35). custom_theme: overrides for bg color/gradient, accent gradient, font family, bg image URL, and card style — Linktree-style premium theme scope. The analytics columns (total_views, total_clicks) are written only by the record-page-view Edge Function — not by the client directly.
finfluencify_live_session_invitees20260630_151_finfluencify_live_session_invitees.sqlEmail-based invitees for finfluencify_live_sessions rows with audience_type='invitees'. Covers both platform users (matched by account email) and external guests with no platform account.
finfluencify_live_session_participants20260701_157_finfluencify_live_session_participants.sqlLive-class attendance, written by finfluencify-zoom-webhook on participant_joined/_left. Idempotent per (session_id, zoom_participant_uuid). SERVICE-ROLE ONLY — RLS denies authenticated access; trainer-facing attendance reads go through a SECURITY DEFINER RPC in the analytics phase.
finfluencify_live_session_recordings20260702_159_finfluencify_live_session_recordings.sqlLive-class recording METADATA ONLY (share_url/play_url/passcode/duration/size). The file stays on Zoom's cloud — nothing is downloaded. Written by finfluencify-zoom-webhook on recording.completed. SERVICE-ROLE ONLY — reads go through get_finfluencify_live_session_recordings().
finfluencify_live_session_reminders20260701_158_finfluencify_live_session_reminders.sqlReminder idempotency ledger. The reminder-sweep cron inserts one row to claim a (session, window, channel) before enqueuing; a UNIQUE violation means the reminder already fired and is skipped. SERVICE-ROLE ONLY.
finfluencify_live_sessions20260630_150_finfluencify_live_sessions.sqlTrainer-scheduled Zoom live classes. audience_type drives who is invited: standalone (nobody — trainer-only), course (that course's enrolled+access_granted students), invitees (specific emails in finfluencify_live_session_invitees). host_start_url_enc/passcode_enc are encrypted and never exposed to RPC callers.
finfluencify_payment_orders20260409_005_finfluencify_payment_orders.sqlSingle source of truth for every Razorpay checkout session on the platform.
finfluencify_plan_audit_log20260406092809_remote_schema.sqlPlan audit trail table. Immutable audit log of all plan changes. Required for regulatory compliance and dispute resolution. Records: assignments, upgrades, downgrades, discounts, approvals. IMMUTABLE (trigger prevents updates).
finfluencify_plan_definitions20260406092809_remote_schema.sqlSubscription plan definitions table. Versioned plan tiers for trainers. New versions allow changing limits without affecting existing customers. Versions are soft-deleted (deprecated_at) for historical tracking. Only is_active=true versions with effective_from <= NOW() are current.
finfluencify_plan_features20260406092809_remote_schema.sqlFeature flags table. Feature enablement configuration for each plan version. Supports enabling/disabling features without database migration. Easy feature experimentation and A/B testing.
finfluencify_poll_options20260406092809_remote_schema.sqlAnswer choices for polls. Position determines display order. response_count is auto-updated via trigger.
finfluencify_poll_responses20260406092809_remote_schema.sqlIndividual student responses to polls. One row per response, updated via trigger for multiple-choice. Allows anonymous/non-anonymous tracking.
finfluencify_polls20260406092809_remote_schema.sqlMain poll table for quick engagement feedback from students. Polls are time-bound and track response rates.
finfluencify_special_offers20260406092809_remote_schema.sqlSpecial promotions and discounts table. Trainer-specific or global discounts. Tracks usage and enforces max_uses limit. Supports various offer types and discount amounts.
finfluencify_stream_webhook_events20260406100000_finfluencify_stream_webhook_events.sqlCloudflare Stream webhook event log. Stores every inbound Cloudflare Stream webhook delivery. The UNIQUE constraint on event_id guarantees exactly-once processing even when CF retries on timeout. Rows are not deleted by the application — use a cron job to purge rows older than 90 days.
finfluencify_student_certificates20260408_finfluencify_certificate_templates.sqlOne row per issued certificate. Created by finfluencify-generate-certificate Edge Function.
finfluencify_students20260406092809_remote_schema.sqlFinFluencify students/mentees table. Stores basic student information including contact details, enrollment status, and engagement metrics. Follows finfluencify_ prefix pattern. Multi-tenant (per-trainer) data. Supports soft deletion via is_active flag.
finfluencify_survey_question_responses20260406092809_remote_schema.sqlIndividual student answers to survey questions. Uses flexible JSONB format to support different question types without multiple columns.
finfluencify_survey_questions20260406092809_remote_schema.sqlIndividual questions within surveys. Supports multiple question types with flexible options, validation rules, and conditional logic.
finfluencify_survey_responses20260406092809_remote_schema.sqlSurvey response sessions (one per student per survey). Tracks completion status, time spent, and progress percentage.
finfluencify_surveys20260406092809_remote_schema.sqlMain survey table for collecting detailed feedback with multiple questions of various types (single-choice, text, rating, etc.)
finfluencify_trainer_active_plans20260406092809_remote_schema.sqlCurrent trainer subscription assignments. Single active record per trainer. When upgrading/downgrading, old record set to is_active=false and new record created as is_active=true. Supports subscription lifecycle tracking.
finfluencify_trainer_zoom_accounts20260629_149_finfluencify_trainer_zoom_accounts.sqlPer-trainer Zoom OAuth connection. Stores AES-256-GCM encrypted access/refresh tokens (encrypted by the edge functions with ZOOM_TOKEN_ENC_KEY before storage) and connection status. SERVICE-ROLE ONLY — RLS denies all authenticated access; clients read status via get_finfluencify_zoom_connection_status().
finfluencify_zoom_webhook_events20260701_156_finfluencify_zoom_webhook_events.sqlZoom webhook idempotency + audit log. UNIQUE(dedupe_key = SHA-256 of raw body) guarantees exactly-once processing across Zoom redeliveries. Every delivery is recorded before any state change. SERVICE-ROLE ONLY — RLS denies all authenticated access. Purge rows older than ~90 days via cron.
fo_market_holidays20260406092809_remote_schema.sqlStores Futures and Options (F&O) segment market holidays fetched from NSE.
giftnifty_status20260406092809_remote_schema.sql
goals20260406092809_remote_schema.sqlStores user-defined financial or personal goals with tracking metrics.
habit_entries20260406092809_remote_schema.sqlTracks completion status of habits for each user on specific dates.
habits20260406092809_remote_schema.sqlDefines user-created habits for tracking, including frequency, goals, and type.
IF20260630_152_finfluencify_live_sessions_rpcs.sql
index_expiry_map20260406092809_remote_schema.sqlStores index names and their expiry dates for Option Chain data fetching.
index_master20260406092809_remote_schema.sqlMaster table for storing detailed data of various NSE indices.
maintenance_window_configurations20260406092809_remote_schema.sqlMaintenance window configurations with persistence, audit trail, and soft-delete support. Supports indefinite and time-bounded maintenance notifications.
message_threads20260406092809_remote_schema.sql
mv_refresh_registry20260423_009_create_mv_refresh_registry.sqlControl table for the refresh-materialized-views Edge Function. Each row represents one materialized view to refresh. The EF queries: SELECT * FROM mv_refresh_registry WHERE enabled ORDER BY refresh_order. Refresh method CONCURRENT requires a UNIQUE index on the MV. F3 fix: EF no longer auto-discovers MVs from pg_matviews.
notification_events20260513_088_notification_fan_out_architecture.sqlFan-out broadcast log. Each row represents a single notification event (e.g., a guide
notification_preferences20260513_088_notification_fan_out_architecture.sqlPer-user, per-category notification delivery preferences.
notifications20260406092809_remote_schema.sql
nse_all_indices20260406092809_remote_schema.sqlNSE index snapshot table (13 rows — major NIFTY indices only). Ingested by the collect-nse-indices Edge Function. DOES NOT contain INDIA VIX. Use index_master for VIX data. Primary key: index_symbol.
nse_all_stocks_traded20260406092809_remote_schema.sqlStores time-series data for all stocks traded on NSE, fetched from the live-analysis-stocksTraded API endpoint.
nse_banknifty_contributors20260406092809_remote_schema.sql
nse_banknifty_historical_data_daily20260406092809_remote_schema.sql
nse_equity_daily_snapshot20260527_119_nse_equity_daily_snapshot.sqlIncremental staging table for mv_equity_daily_eod. One row per (symbol, trade_date).
nse_equity_session_stats20260527_121_nse_equity_session_stats.sqlIncremental staging table for mv_equity_volume_surges. One row per (symbol, session_date).
nse_finserv_contributors20260406092809_remote_schema.sql
nse_finserv_historical_data_daily20260406092809_remote_schema.sql
nse_index_weightages20260406092809_remote_schema.sqlDEPRECATED FOR MARKET MOOD ANALYSIS (2026-04-21):
nse_indices20260406092809_remote_schema.sqlStores fetched data for NSE market indices.
nse_ipo_current_issue20260406092809_remote_schema.sql
nse_market_status20260406092809_remote_schema.sql
nse_midcap_select_contributors20260406092809_remote_schema.sql
nse_midcap_select_historical_data_daily20260406092809_remote_schema.sql
nse_most_active_equities_by_value20260406092809_remote_schema.sql
nse_most_active_equities_by_volume20260406092809_remote_schema.sql
nse_nifty_next50_contributors20260406092809_remote_schema.sql
nse_nifty_next50_historical_data_daily20260406092809_remote_schema.sql
nse_nifty50_contributors20260406092809_remote_schema.sql
nse_nifty50_historical_data_daily20260406092809_remote_schema.sql
nse_nifty500_contributors20260406092809_remote_schema.sqlNifty 500 constituent data polled during market hours (~62.5K rows/day).
nse_nifty500_session_eod20260527_122_nse_nifty500_session_eod.sqlIncremental staging table for vw_gap_down_stocks and vw_key_level_breachers.
nse_oi_spurts_data20260406092809_remote_schema.sql
nse_volume_gainers20260406092809_remote_schema.sql
option_chain_live20260406092809_remote_schema.sqlLive option chain data for all indices, all strikes and expiries. Polled during
page_guides20260406092809_remote_schema.sql
plan_quality_scores20260512_086_plan_quality_scores.sqlAnalytics projection of trade_planner_plans. Pre-computed by Postgres trigger (trig_compute_plan_quality_scores) on every INSERT/UPDATE to trade_planner_plans. Separates the analytics concern from the operational record — all dashboard queries hit this table only; the main plans table is never scanned for aggregate reporting. Consumer: get_planning_intelligence RPC (Phase 7). Not directly exposed to client code.
post_bookmarks20260406092809_remote_schema.sql
post_likes20260406092809_remote_schema.sql
post_poll_votes20260406092809_remote_schema.sql
profiles20260406092809_remote_schema.sqlStores user profile information, including custom fields and admin status.
psychology_builder_archetype_insights20260504_055_trader_archetype_insights.sqlStores generated behavioral insights for a user's current profile.
psychology_builder_archetype_profiles20260504_053_trader_archetype_profiles.sqlOne row per user. Stores the current multi-dimensional psychological profile
psychology_builder_archetype_snapshots20260504_054_trader_archetype_snapshots.sqlAppend-only history table. One row per profile version per user.
psychology_builder_bias_acknowledgments20260505_058_trader_bias_acknowledgments.sqlPersistent bias acknowledgment records.
psychology_journal_entries20260406092809_remote_schema.sqlEntries for the psychology journal, tracking moods and reflections related to trading.
psychology_modules20260406092809_remote_schema.sql
quick_access_controls20260406092809_remote_schema.sql
reserved_slugs20260406092809_remote_schema.sqlAuthoritative reserved-slug policy table. ~736 seed entries across 9 categories. Add new rows via INSERT ... ON CONFLICT DO NOTHING for brand protection, legal holds, or new app routes. Never remove entries — set is_active = FALSE instead to preserve audit trail. This table is the SINGLE SOURCE OF TRUTH for slug reservations. No client-side constants or hardcoded lists should duplicate this data.
risk_profiles20260406092809_remote_schema.sqlUser-defined risk parameters like max drawdown and risk per trade.
sector_constituents20260406092809_remote_schema.sqlStores the constituent stocks for each sectoral index.
session_review_entries20260505_059_session_review_entries.sqlPost-period reflection and decision-quality entries for all trader and investor
trade_journal_entries20260510_074_fix_trade_planner_schema.sqlImmutable trade journal — one row per executed trade. Records cannot be deleted. Only today's records may be updated (trade-journal-save EF rejects past-date UPDATE with 403). Linked to trade_planner_plans via trade_plan_id (nullable FK). Financial columns (entry_price, exit_price, pnl, capital_at_risk, brokerage) converted from real to numeric(12,2) in migration 076 to eliminate floating-point rounding errors. RPC access: get_plan_execution_stats() returns linked entries per plan (migration 082).
trade_plan_executions20260406092809_remote_schema.sqlLinking table that connects executed trades to their planned setups, tracking execution quality and deviations.
trade_plan_lifecycle_log20260513_090_trade_plan_updates_lifecycle_log.sqlSystem-generated audit trail of all lifecycle state transitions for
trade_plan_pending_uploads20260528_115_media_attachments_infrastructure.sqlTracks R2 chart-image uploads initiated (presigned URL issued) but not yet confirmed (plan not saved).
trade_plan_share_recipients20260514_094_trade_plan_shares.sqlExplicit access list for private shares. Each row grants a specific registered user
trade_plan_shares20260514_094_trade_plan_shares.sqlTrade plan share records. Each row represents a sharing link created by a plan owner.
trade_plan_updates20260513_090_trade_plan_updates_lifecycle_log.sqlAppend-only execution log for trade_planner_plans. Each row records one
trade_planner_executions20260510_074_fix_trade_planner_schema.sqlJoin table linking each trade_journal_entries row to its parent trade_planner_plans row. Auto-populated by the sync_plan_execution_fn trigger (migration 075) on trade INSERT. uq_tpe_trade_id enforces one execution row per trade — one trade belongs to at most one plan. execution_quality and r_multiple are user-annotated later via the trade-planner-save EF; they are never written by the trigger. Phase 7: execution_quality feeds behavioral analytics.
trade_planner_plans20260510_074_fix_trade_planner_schema.sqlUser trade plans (daily/weekly/monthly). Records are permanent — immutability enforced by RLS (no DELETE policy) and trade-planner-save EF (rejects updates to past plans with 403). is_active column removed in migration 077. Schema v2 additions (migration 077): market_bias, min_reward_risk, idx_tpp_user_date. RPC access layer: get_trade_plans() and get_plan_execution_stats() (migration 082).
trade_plans20260406092809_remote_schema.sqlStores user-created trading plans, including market notes and watchlists.
trades20260406092809_remote_schema.sqlRecords individual trade details, including entry/exit prices, PNL, and strategy.
user_badges20260406092809_remote_schema.sqlStores badges earned by users for achieving habit milestones.
user_brokers20260406092809_remote_schema.sqlLists brokers linked by users to their accounts.
user_feedback20260406092809_remote_schema.sql
user_follows20260406092809_remote_schema.sql
user_psychology_progress20260406092809_remote_schema.sql
user_screener_favorites20260406092809_remote_schema.sql
user_screeners20260406092809_remote_schema.sql
user_trading_rules20260406092809_remote_schema.sql

Generated file

Do not edit by hand. Regenerate with npm run docs:gen after adding migrations.