Cosmovex guides · practical workflows

Compare Postgres Schemas and Generate an ALTER Migration in Your Browser

When a database definition changes, a useful review starts with two questions: what changed, and which SQL statements express that change?

Schema Diff Studio by Cosmovex compares before-and-after Postgres or SQLite schemas. It generates a migration and checks the resulting schema in an in-browser database. Comparing schemas and copying the migration are available free, without signup.

Start with a small example

Suppose a task list begins with this table:

CREATE TABLE tasks (
  id integer PRIMARY KEY,
  title text NOT NULL
);

You now want to distinguish completed tasks:

CREATE TABLE tasks (
  id integer PRIMARY KEY,
  title text NOT NULL,
  completed boolean NOT NULL DEFAULT false
);

The intended change is an added column. A SQL statement expressing it is:

ALTER TABLE tasks
ADD COLUMN completed boolean NOT NULL DEFAULT false;

Use these definitions as a small, synthetic example to explore the comparison workflow. This article does not report a runtime test of that example in the tool.

Compare the two definitions

  1. Open Schema Diff Studio and choose Postgres.
  2. Put the original definition in Before and the updated definition in After.
  3. Run the comparison and inspect the generated migration and verification result.
  4. Review the SQL before copying it into your migration workflow.

For an existing project, schema-only dumps can provide the starting definitions. Keep Before and After from the same environment and record which application version each represents; otherwise, an unrelated staging change can be mistaken for part of your feature.

Schema verification has a specific meaning

The tool applies the migration to a fresh database and compares the resulting schema with After. That does not establish how it will behave with your production rows, workload, permissions or deployment process. Review data backfills and application compatibility separately, particularly when removing columns or changing types.

The free tier includes comparison and migration copy. Pro adds features including migration file downloads, rollback generation and version history. You can try the comparison before deciding whether those extras fit your workflow.

Compare your schemas in Schema Diff Studio →