Add Agent System to VinaJet Database

Extend your existing VinaJet Supabase database with the agent commission system. This migration adds agent tables, commission tracking, and tier management to your current schema.

Database Configuration
Current Database
Supabase
Environment
production
Status
Checking...
Database Setup

Environment Variables

Add these to your .env.local file:

NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
NEXT_PUBLIC_USE_SUPABASE=true

Add Agent System to Existing Database

  1. Access your existing Supabase project's SQL Editor
  2. Verify your project has the basic VinaJet schema (profiles, bookings, etc.)
  3. Run the agent system migration from the tabs above
  4. Check that agent tables were created successfully
  5. Test the connection by refreshing this page
Quick Test

After setting up the database, test these features:

Agent System
  • • Register new agent account
  • • Login with demo agent: agent@example.com
  • • View tier progress and commission tracking
  • • Test booking attribution
User System
  • • User registration and profile creation
  • • OAuth login (Google/Facebook)
  • • Booking management
  • • Commission calculation

🚀 Migration Guide

  1. Access your existing Supabase project's SQL Editor
  2. Copy the migration SQL from the "Schema" tab above
  3. Run the migration to add agent tables
  4. Verify your environment variables are set
  5. Set NEXT_PUBLIC_USE_SUPABASE=true
  6. Test agent registration and login

🏗️ Database Features

  • 5-tier agent hierarchy (Starter → Legend)
  • Automatic commission calculation
  • Quarterly tracking with grace periods
  • Real-time tier promotions
  • Booking attribution & tracking
  • Row-level security (RLS)

🧪 Test the System

Demo agent credentials: agent@example.com (Elite tier with sample data)