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 startCreate a migration
supabase migration new add_profile_fieldsAdd 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 --localThis applies pending migrations to your local database.
Verify
supabase migration list --localConfirm 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 loginLink your project
supabase linkSelect the project you want to update.
Preview the pending migrations
supabase db push --linked --dry-runReview the migration list and SQL before applying it.
Apply the migrations
supabase db push --linkedVerify
supabase migration list --linkedConfirm 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 --localThe 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.