Generate seed.sql for Supabase Local Development

Generate production-ready seed.sql files for Supabase local development. Import schemas, generate realistic data, and test locally before deploying.

Why Supabase Developers Use MockBlast

Supabase's local development flow relies on seed.sql files to populate your database with test data. MockBlast makes generating these files effortless:

πŸ—„οΈ PostgreSQL-Compatible

Supabase uses PostgreSQL under the hood. MockBlast generates Postgres-compatible SQL that works perfectly with Supabase, including JSONB, UUID, and foreign keys.

πŸ”„ Reset-Ready Seed Files

Generate seed.sql files that work with 'supabase db reset'. Quickly reset your local database to a known state with realistic test data every time.

πŸ”— Referential Integrity

MockBlast maintains foreign key relationships automatically. Generate data for multiple tables with proper relationships that Supabase's constraints accept.

⚑ Fast Local Development

Generate thousands of rows instantly for local testing. Test pagination, search, and performance locally before deploying to production.

Supabase Local Development Workflow

MockBlast fits perfectly into the Supabase CLI workflow:

  1. 1.
    Define Your Schema: Create your tables in Supabase Studio or write migration files.
  2. 2.
    Copy to MockBlast: Paste your CREATE TABLE statements into MockBlast's SQL import.
  3. 3.
    Generate Seed Data: MockBlast creates realistic INSERT statements compatible with Supabase.
  4. 4.
    Save as seed.sql: Download the SQL and save it to supabase/seed.sql
  5. 5.
    Reset Database: Run supabase db reset to apply migrations and seed data.

Example: Supabase Seed File

Your Supabase Schema:

CREATE TABLE profiles (
  id UUID PRIMARY KEY REFERENCES auth.users(id),
  username VARCHAR(50) UNIQUE NOT NULL,
  full_name TEXT,
  avatar_url TEXT,
  created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);

CREATE TABLE posts (
  id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
  profile_id UUID REFERENCES profiles(id),
  title TEXT NOT NULL,
  content TEXT,
  published BOOLEAN DEFAULT false,
  created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);

Generated supabase/seed.sql:

-- Seed data for local development
INSERT INTO profiles (id, username, full_name, avatar_url, created_at) VALUES
  ('550e8400-e29b-41d4-a716-446655440000', 'johndoe', 'John Doe', 
   'https://avatar.example.com/john.jpg', '2024-01-15 10:30:00+00'),
  ('6ba7b810-9dad-11d1-80b4-00c04fd430c8', 'janesmith', 'Jane Smith',
   'https://avatar.example.com/jane.jpg', '2024-01-16 14:20:00+00');

INSERT INTO posts (id, profile_id, title, content, published, created_at) VALUES
  ('7c9e6679-7425-40de-944b-e07fc1f90ae7', '550e8400-e29b-41d4-a716-446655440000',
   'Getting Started with Supabase', 'Lorem ipsum...', true, '2024-01-17 08:15:00+00'),
  ('a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11', '6ba7b810-9dad-11d1-80b4-00c04fd430c8',
   'Supabase Local Development', 'Lorem ipsum...', false, '2024-01-18 12:30:00+00');

Common Supabase Seed Use Cases

πŸ§ͺ Local Testing

Test your Supabase functions, RLS policies, and queries locally with realistic data before deploying to production.

πŸ‘₯ Team Development

Share seed.sql files with your team so everyone has the same local database state. Perfect for consistent development environments.

🎨 UI Development

Generate realistic data to develop and test UI components locally. See how your app looks with proper data before going live.

πŸ”„ Migration Testing

Test database migrations locally with seed data. Ensure your schema changes work correctly before applying them to production.

Tips for Supabase Seed Files

  • β€’Use UUID for profiles.id: Match the UUID from auth.users to maintain referential integrity with Supabase auth.
  • β€’Disable RLS for Seeding: Add ALTER TABLE ... DISABLE ROW LEVEL SECURITY; before your INSERT statements in seed.sql if needed.
  • β€’Order Tables by Dependency: Insert parent tables before child tables to avoid foreign key errors. MockBlast helps identify these relationships.
  • β€’Test Locally First: Always test your seed.sql with supabase db reset locally before committing to your repository.

Related Resources

Frequently Asked Questions

What is a Supabase seed.sql file?
A seed.sql file is used by the Supabase CLI to populate your local database with test data. It runs when you start your local Supabase instance with 'supabase db reset' or 'supabase start', making it perfect for development and testing.
Can I import my Supabase schema into MockBlast?
Yes! MockBlast works with standard PostgreSQL syntax, which is what Supabase uses. You can copy your CREATE TABLE statements from Supabase Studio or your migration files and paste them into MockBlast.
Does MockBlast support Supabase Row Level Security (RLS)?
MockBlast generates INSERT statements that work with RLS policies. However, if your RLS policies require specific conditions (like user auth), you may need to temporarily disable RLS or adjust policies for seed data.
Can I generate data for Supabase's auth schema?
MockBlast is best for application tables. For auth.users and auth-related tables, we recommend using Supabase's built-in test users or custom scripts, as these tables have specific requirements and triggers.
How do I use the generated seed.sql with Supabase CLI?
Place the generated seed.sql file in your supabase/seed.sql path. Then run 'supabase db reset' to reset your local database and apply seed data. Perfect for consistent local development environments.

Ready to Generate Mock Data?

Stop writing scripts manually. MockBlast generates production-ready seed data for Postgres, MySQL, MongoDB, and JSON in seconds.