Files
Portfolio/supabase/MIGRATION_INSTRUCTIONS.md
T
damjan_savicandClaude Sonnet 4.5 062e49ca65 auto-claude: subtask-1-2 - Apply migration to Supabase database
Created migration application scripts and comprehensive documentation:
- scripts/apply-migration.js - Automated migration (requires service role key)
- scripts/verify-migration.js - Table verification script
- scripts/test-env.js - Environment diagnostics
- supabase/APPLY_MIGRATION.md - Comprehensive migration guide
- supabase/MIGRATION_INSTRUCTIONS.md - Quick reference

Manual application via Supabase dashboard is recommended approach.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-25 06:38:29 +01:00

2.2 KiB

Supabase Migration Instructions

Apply Migration: Create rate_limits Table

Quick Steps

  1. Open Supabase SQL Editor

  2. Copy Migration SQL

    • Open: supabase/migrations/20260125_create_rate_limits_table.sql
    • Copy all contents (Ctrl+A, Ctrl+C)
  3. Execute Migration

    • Paste the SQL into the Supabase SQL editor
    • Click the "Run" button (or press Ctrl+Enter)
    • Wait for "Success. No rows returned" message
  4. Verify Table Creation

Expected Table Schema

The rate_limits table should have:

Column Type Description
identifier TEXT Client identifier (IP address)
count INTEGER Number of requests in window
window_start TIMESTAMPTZ Start of rate limit window
created_at TIMESTAMPTZ When record was created
updated_at TIMESTAMPTZ When record was last updated

Primary Key: (identifier, window_start)

Indexes:

  • idx_rate_limits_identifier_window on (identifier, window_start DESC)
  • idx_rate_limits_window_start on (window_start)

Alternative: Using Supabase CLI (if available)

If you have Supabase CLI installed:

supabase db push

Or apply the specific migration:

supabase migration up

Verification Query

Run this query in the SQL editor to verify the table exists:

SELECT
  table_name,
  column_name,
  data_type,
  is_nullable
FROM information_schema.columns
WHERE table_name = 'rate_limits'
ORDER BY ordinal_position;

You should see all 5 columns listed.

Troubleshooting

Error: "relation already exists"

  • The table already exists. You can verify by checking Table Editor.

Error: "permission denied"

  • Make sure you're logged into the correct Supabase project.
  • Verify you have admin/owner access to the project.

Table not appearing in Table Editor

  • Refresh the page (F5)
  • Check the SQL editor for any error messages
  • Verify the SQL was executed successfully