How to Compare Database Schemas Before Deploying
A step-by-step workflow for catching schema drift between staging and production in Phoenix apps.
Paste two CREATE TABLE dumps from your Phoenix app — whether from mix ecto.dump, pg_dump --schema-only, or raw SQL exports from PostgreSQL. Spot every table, column, index, and constraint change instantly. Get ready-to-run ALTER TABLE scripts — all in your browser.
No account required. No data leaves your device.
SchemaLens understands Elixir-specific patterns that generic diff tools miss.
Compare mix ecto.migrate outputs before and after schema changes. Verify that your migration scripts match the Ecto.Schema definitions exactly before deploying to production.
Detects field :name, :string → field :name, :citext, precision changes on :decimal fields, and null: false additions that break existing Repo.insert! calls.
Diffs create index(), unique_index(), and create constraint() declarations in migrations. Catches missing indexes that could slow down Ecto query performance.
Validates belongs_to, has_many, and many_to_many foreign key constraints. Detects missing or changed references that could break Ecto preload and association queries.
Compares schemas across Phoenix Context boundaries. Detects when a shared table schema diverges between contexts like Accounts.User and Profiles.User.
Your schema never leaves the browser. Compare production Phoenix schemas safely without uploading sensitive table structures to a third-party server.
Run mix ecto.dump or pg_dump --schema-only on both environments (local vs staging, or staging vs production).
Copy the SQL into the two editor panes. Dialect auto-detects PostgreSQL — the default and most common database for Phoenix applications.
See added tables, dropped columns, type changes, and constraint modifications highlighted in color. Check for breaking changes before your next mix phx.server deploy.
Export ALTER TABLE scripts, save as Markdown for PR descriptions, or generate rollback SQL. Run in staging, then production.
SchemaLens generates production-ready ALTER TABLE scripts for every change it detects.
ALTER TABLE users
ADD COLUMN email_verified BOOLEAN DEFAULT FALSE;
ALTER TABLE users
ALTER COLUMN email TYPE CITEXT;
ALTER TABLE orders
ADD CONSTRAINT fk_orders_user_id
FOREIGN KEY (user_id) REFERENCES users(id)
ON DELETE CASCADE;
CREATE UNIQUE INDEX users_email_index
ON users (email);
A step-by-step workflow for catching schema drift between staging and production in Phoenix apps.
Learn how to catch dropped columns, missing indexes, and type changes before they cause incidents.
Deep-dive into PostgreSQL-specific schema comparison features and migration generation.
Join thousands of developers who use SchemaLens to catch schema changes before they hit production.
Start Comparing FreeFree for up to 15 tables. Lifetime Pro — $39 once.