PostgreSQL · MySQL · SQL Server
Browse database guides

How to compare database schemas and review a change

Compare the intended schema with a target, resolve the checks that matter and understand what the rehearsal actually tested before you apply the change.

Download the correct product
On this page

01 / RESOURCES

1. Start with a recoverable target

Use source and target connections for the same database engine. Confirm their names, environment labels and permissions. Establish a recovery plan appropriate to the target before changing it. A dbHydrate schema snapshot records structure; it does not preserve the table data needed to recover from every change.

02 / RESOURCES

See the change before it runs.

Compare source and target definitions, choose the changes, then review the operation.

03 / RESOURCES

2. Limit the comparison

Choose the namespaces and objects relevant to the change. Inspect any incomplete-read or unsupported-object warnings before interpreting the comparison. Select the differences you intend to deploy and review the generated SQL, dependency ordering and operations that could remove data.

04 / RESOURCES

3. Resolve preflight findings

Look for duplicate values before a unique constraint, missing parent rows before a foreign key, and null values before a NOT NULL change. A required new column may also need a suitable default or data preparation. Treat skipped or timed-out checks as unresolved evidence.

05 / RESOURCES

4. Read the rehearsal mode

Run the available dry run and inspect its result. PostgreSQL and SQL Server use supported transactional paths, with exceptions for incompatible operations. MySQL uses a shadow database for DDL rehearsal; success there does not establish that every target row satisfies the proposed change.

06 / RESOURCES

5. Confirm the actual target

Review the target fingerprint and any drift warning. High protection requires a passing dry run, a schema snapshot and the typed target confirmation. Schema apply has no general Cancel action: resolve uncertainty before starting, then follow the reported phase, statement and outcome.

07 / RESOURCES

6. Verify and recover deliberately

Compare the affected objects again and test the application behavior the change supports. If an operation fails, inspect the actual target before rerunning it; transactional and nontransactional operations can leave different outcomes. Use your recovery plan when restoring structure alone cannot repair the data.

08 / RESOURCES

Example: inspect the columns on each connection

For an illustrative orders table, run the following read-only query separately on the source and target. INFORMATION_SCHEMA.COLUMNS is available in PostgreSQL, MySQL and SQL Server. Select the correct database and inspect TABLE_SCHEMA so similarly named tables are not confused.

This inventory can help explain a column difference. It does not compare indexes, constraints, triggers or all engine-specific attributes, and it is not a replacement for the schema comparison. Return to the generated change list to review the complete supported scope.

Code example
SELECT TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, DATA_TYPE
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'orders'
ORDER BY TABLE_SCHEMA, ORDINAL_POSITION;
Schema comparison and engine-specific safeguards ↗Compare table data separately ↗

Questions & answers

Does a successful dry run guarantee a successful deployment?

No. Its evidence depends on the engine, operation, rehearsal mode and target state. Review limitations and changes made after the check.

Can I compare PostgreSQL with SQL Server?

Schema Sync works between databases using the same engine. It is not a cross-engine migration tool.

Workflow illustration

SCHEMA SYNCSOURCE · DEVELOPMENTTARGET · STAGINGcustomerscustomersidemail+ timezoneidemailColumn not present+REVIEW THE GENERATED SQLALTER TABLE customersADD COLUMN timezone text;PostgreSQL example · same-engine comparison