Skip to Content
DatabaseSchema & Migration

Schemas and migrations

NativeExpress stores database changes as SQL files in supabase/migrations/. Use the Supabase CLI to test them locally and apply them to your hosted project.

Prerequisites

Install the Supabase CLI and run the commands below from your app’s root directory. Local development also needs a running Docker-compatible container runtime .

Files

      • 20260904000000_initial_schema.sql
    • config.toml - Local configuration

The initial migration creates the boilerplate schema for a new project. Add subsequent changes in new migration files.

Test a schema change locally

Start the local stack

supabase start

Create a migration

supabase migration new add_profile_fields

Add your SQL to the new file in supabase/migrations/. Use a name that describes your change. Supabase’s migration guide  includes examples of creating tables and adding columns.

Apply the migration

supabase migration up --local

This applies pending migrations to your local database.

Verify

supabase migration list --local

Confirm that your migration is applied, then check the changed table in local Supabase Studio. supabase start prints the Studio URL.

Apply migrations to a hosted project

Sign in to the CLI

supabase login
supabase link

Select the project you want to update.

Preview the pending migrations

supabase db push --linked --dry-run

Review the migration list and SQL before applying it.

Apply the migrations

supabase db push --linked

Verify

supabase migration list --linked

Confirm that the local migration files and hosted migration history match, then check your changed table in the Supabase Dashboard. After a schema change, regenerate your database types.

Reset a local database

Resetting deletes the database’s data before replaying its migrations. Keep --local for this check. --linked resets your hosted database instead.

To test all migrations from an empty database:

supabase db reset --local

The boilerplate ships no seed data and [db.seed] is disabled in supabase/config.toml. To add test data, enable it and create supabase/seed.sql.

Last updated on