How to Compare Database Schemas Before Deploying
A step-by-step workflow for catching schema drift between staging and production in Django apps.
Paste two python manage.py sqlmigrate outputs or raw CREATE TABLE dumps from your Django app. Spot every table, column, index, and constraint change instantly. Get ready-to-run ALTER TABLE scripts for PostgreSQL or MySQL — all in your browser.
No account required. No data leaves your device.
SchemaLens understands Django-specific patterns that generic diff tools miss.
Compare the output of manage.py sqlmigrate before and after model changes. Verify that makemigrations produced exactly the schema you expected.
Detects CharField → TextField, IntegerField → BigIntegerField, and nullability changes. Warns when max_length reductions could truncate data.
Diffs unique_together, indexes, constraints, and db_table changes in your Model Meta. Catches schema drift that Django's built-in diff misses.
Validates ForeignKey, OneToOneField, and ManyToManyField changes. Detects missing on_delete behaviors and through-table modifications.
Detects changes inherited from abstract base models (TimeStampedModel, SoftDeleteModel). Catches when a base model change propagates unexpectedly.
Your schema never leaves the browser. Compare production Django schemas safely without uploading sensitive table structures to a third-party server.
Run python manage.py dbshell -c "\\dt" and export with pg_dump --schema-only (PostgreSQL) or mysqldump --no-data (MySQL).
Copy the SQL into the two editor panes. Dialect auto-detects PostgreSQL or MySQL based on your Django DATABASES config.
See added tables, dropped columns, type changes, and constraint modifications highlighted in color. Check for breaking changes before running migrate.
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 "blog_post"
ALTER COLUMN "title" TYPE VARCHAR(200);
ALTER TABLE "orders"
ADD COLUMN "tracking_number" VARCHAR(100) NULL;
ALTER TABLE "users"
ADD CONSTRAINT "users_email_unique"
UNIQUE ("email");
CREATE INDEX "orders_status_idx"
ON "orders" ("status");
A step-by-step workflow for catching schema drift between staging and production in Django 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.