Prerequisites

  • Supabase project
  • Access to Supabase Dashboard
  • Xata account and project setup
  • Network access to your Supabase database

Install and Configure the Xata CLI

Install the Xata CLI:
curl -fsSL https://xata.io/install.sh | bash
Authenticate with your Xata account:
xata auth login

Get Connection String

Find Your Connection Details

  1. Go to Supabase Dashboard → Your Project
  2. Go to “Settings” → “Database”
  3. Copy the connection string from “Connection string” section

Connection String Format

Supabase connection strings typically look like this:
postgresql://your_username:your_password@db.[YOUR-PROJECT-REF].supabase.co:5432/postgres

SSL Configuration

Supabase requires SSL by default. Include SSL parameters in your connection string:
postgresql://your_username:your_password@db.[YOUR-PROJECT-REF].supabase.co:5432/postgres

Initialize Xata Project

Set up your Xata project configuration:
xata init

Configure the Migration

Set up your clone configuration with optional anonymization:
# Set your source URL
export XATA_CLI_SOURCE_POSTGRES_URL="postgresql://your_username:your_password@db.project-ref.supabase.co:5432/postgres"

# Configure anonymization rules
xata clone config --source-url $XATA_CLI_SOURCE_POSTGRES_URL --mode prompt

Start the Migration

Begin the data transfer:
# Start the migration
xata clone start --source-url $XATA_CLI_SOURCE_POSTGRES_URL

Monitor Progress

Check the migration status:
xata clone status

Verification

After migration, verify your data:
  1. Connect to Xata Branch:
    psql `xata branch url`
    
  2. Check Data Integrity:
    -- Compare row counts
    SELECT COUNT(*) FROM your_table;
    
    -- Check sample data
    SELECT * FROM your_table LIMIT 10;
    
  3. Test Relationships: Verify foreign key relationships work correctly

Next Steps