← Back to list

Supabase vs Laravel: Migration Paradigms

Framing your brain into thinking “the Supabase way” when dealing with deterministic migrations and seeders

JP Caparas · 2025-12-08 10:53 · 0 claps · 3.5 min read
#supabase #laravel #migration #seeder #vibe-coding
Open on Medium ↗
Wiki topics: 💻 · Programming

Supabase vs Laravel: Migration Paradigms

Framing your brain into thinking “the Supabase way” when dealing with deterministic migrations and seeders

Two different approaches to migrations.

Two different approaches to migrations.

This guide explains the core differences between Laravel’s migration philosophy and Supabase’s Postgres-native migration system. It also outlines the practical workflow patterns you should follow when developing locally and deploying to production.

1. Underlying Philosophies

Laravel

Laravel treats migrations as reversible steps in an application-driven workflow. Each migration contains two methods:

  • up() applies a change.
  • down() reverses the change.

This enables fine-grained rollbacks, iterative corrections, and controlled partial reversions. The database is a persistent working environment that evolves as you build features.

Supabase

Supabase treats its database as a Postgres state machine governed entirely by SQL migration files. It does not assume reversibility. It prioritises:

  • deterministic replay of the entire migration history
  • forward-only changes
  • validation through full resets
  • clear separation between local schema experimentation and production schema safety

Local databases are considered disposable. Migrations are the actual source of truth.

2. How Migrations Are Created

Laravel

You write migrations manually:

php artisan make:migration add_users_table

Then define changes in PHP DSL (Schema::create, Schema::table, etc.).

Laravel’s migration builder abstracts SQL away and ensures reversible logic.

Supabase

Supabase migrations reflect actual SQL changes detected in the local Postgres instance. You do not start by writing a migration file. Instead, you:

  1. Modify the schema manually (Studio, SQL editor, psql).
  2. Generate a migration diff:
supabase db diff -f add_users_table

The CLI inspects the difference between the running database and the recorded migration history, then emits a SQL file.

There is no down() equivalent. Migration files are one-way instructions.

3. How Migrations Are Applied

Laravel

Laravel maintains a migrations table with batch numbers. You apply migrations with:

php artisan migrate

To roll back:

php artisan migrate:rollback
php artisan migrate:rollback --step=1

This allows partial reversions without rebuilding the entire database.

Supabase

Supabase applies migrations through replay. The core commands are:

Local rebuild and validation:

supabase db reset

This drops the local database then runs all migrations from the beginning.

Deploying migrations to a hosted project:

supabase db push

This applies migrations to a remote database and requires supabase link.

There is no mechanism to run “just the down step of the last migration”.

4. Rollbacks and Reversions

Laravel

Laravel is designed for reversible operations. Each migration safely travels backwards through explicit logic in down().

Rollback is a first-class, everyday tool.

Supabase

Supabase assumes forward-only evolution.

Local rollback = full rebuild via:

supabase db reset

Partial rebuilds are possible with:

supabase db reset --last=1
supabase db reset --version=<timestamp>

These still recreate the entire database up to a point. They do not reverse a single migration in place.

Production-level rollback uses compensating migrations:

You write a new migration that undoes the previous change (for example, dropping a column that was mistakenly added). You never reuse or edit old migrations once they’re deployed.

Rollback is not a mode. It is a new forward step.

5. Seeder Philosophy

Laravel

Seeders populate the database with initial or test data. They complement migrations but aren’t essential for rollback workflows.

Developers often work against a live-ish local database without resetting it frequently.

Supabase

Seeders become central to your workflow because:

  • supabase db reset is routine.
  • Local databases are intentionally destroyed and rebuilt often.
  • Migrations provide structure, seeders provide baseline data.

Without comprehensive seeders, resets would require manual re-population.

Good Supabase projects maintain:

  • core seed SQL
  • dev/test seed SQL

6. When to Use supabase db push

supabase db push is only for remote environments.

Local development does not require it and should not use it.

Use it when:

  1. Your migrations have been tested with supabase db reset.
  2. You are confident they replay cleanly from scratch.
  3. You have linked your project:

If a migration breaks on a remote DB, you must add a new migration to repair it. You do not roll backward.

7. Practical Local Workflow Summary

A typical Supabase workflow looks like:

# Change your schema manually (Studio or SQL)
supabase db diff -f add_feature_table

# Review and adjust the migration SQL
# Ensure the order makes sense

# Validate end-to-end:
supabase db reset

This proves:

  • The migration history is consistent.
  • Replaying from zero works.
  • The app can handle cold-boot structures.

Seeders then restore usable data.

Laravel’s workflow would have involved migrate, experiment, rollback, adjust migration, etc. Supabase replaces that entire loop with “replay everything cleanly”.

8. Conceptual Summary

Laravel: Evolving State

Laravel sees the database as a persistent, evolving environment. You carefully step forwards and backwards. Reversibility is a feature.

Supabase: Deterministic Replay

Supabase sees migrations as a linear history defining the schema. Local databases are disposable. You replay migrations from zero to validate correctness. Forward-only adjustments are expected.

Paradigms to remember

  1. Supabase encourages migration determinism, not in-place reversions.
  2. supabase db reset is the normal local mechanism for testing schema integrity.
  3. Seeders are vital because resets are common and intentional.
  4. supabase db push is for production-grade deployment, never casual local use.
  5. Rollbacks in Supabase are done via new forward migrations, not reversing existing ones.
  6. Laravel and Supabase operate under fundamentally different assumptions about the mutability of database history.

Laravel’s workflow would have involved migrate, experiment, rollback, adjust migration, etc. Supabase replaces that entire loop with “replay everything cleanly”.


메타데이터
post_id
14150f8d36bc
slug
supabase-vs-laravel-migration-paradigms-14150f8d36bc
url
https://medium.com/@jpcaparas/supabase-vs-laravel-migration-paradigms-14150f8d36bc
canonical_url
https://medium.com/@jpcaparas/supabase-vs-laravel-migration-paradigms-14150f8d36bc
author_url
https://medium.com/@jpcaparas
status
ok
fetched_at
2026-07-16 16:07:23