Open-Source Schema Migration Tools



What is a migration script?

A database migration script is an ordered set of SQL Data Definition Language (DDL) and Data Manipulation Language (DML) commands that transitions a database schema from one known state to another predictably, applied in version order exactly once against each target database[1]. Backend developers use migration scripts to apply schema changes across development, staging, and production environments without manual intervention.

DbSchema's Execute Script In Database dialog stepping through the generated migration script, statement 1 of 75, for review before execution

Manual ALTER TABLE statements executed directly in database consoles introduce silent configuration drift, broken constraints, and downtime. A version-controlled database migration tool workflow ensures that every team member and CI/CD runner applies identical schema modifications in the exact same sequence.

Worked Before-and-After Schema Diff

Consider an operational table storing customer profiles where the application requires email verification tracking. The initial schema and the updated schema require an additive column migration.

StateSchema DefinitionOperation
Before MigrationCREATE TABLE users ( id SERIAL PRIMARY KEY, username VARCHAR(50) NOT NULL, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP );Initial baseline table definition in production.
After MigrationCREATE TABLE users ( id SERIAL PRIMARY KEY, username VARCHAR(50) NOT NULL, email_verified BOOLEAN DEFAULT FALSE NOT NULL, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP );Target schema state containing the verification column.
Migration Script (DDL)ALTER TABLE users ADD COLUMN email_verified BOOLEAN DEFAULT FALSE NOT NULL;Deterministic migration statement executed against the live database.

Reviewing the generated DDL before execution prevents destructive operations, such as accidental column drops or locking large tables during unindexed alterations.

How to generate a migration file?

Migration files capture schema transitions as static files that developers commit to version control. Engineering teams generate these files through manual SQL authoring, command-line baseline diffs, or visual schema modeling tools.

DbSchema comparing an open .dbs model against a second model file and listing only the real schema differences

In DbSchema, the entire database design model is saved locally as an offline, portable.dbs project file formatted in plain XML. Because the file contains pure XML, developers commit and branch it inside Git alongside application source code.

DbSchema generates migration scripts by comparing two distinct schema versions: either two local.dbs model revisions in Git or the offline model against a live target database. DbSchema detects table additions, modified data types, updated foreign keys, and altered indexes, then outputs the precise DDL script required to reconcile the differences.

Comparing Migration Generation Approaches

  • Visual Model Comparison: Modify tables on an interactive ER diagram, run schema comparison against the target engine, and generate target-specific DDL scripts.
  • Changelog Introspection: Execute Liquibase commands such as generate-changelog or diff-changelog to introspect a live catalog and output XML, YAML, JSON, or formatted SQL files, depending on the extension you give the changelog filename[2].
  • Manual SQL Numbering: Write raw SQL files prefixed with incremental version numbers (such as V1init.sql and V2add_email_verified.sql) for CLI execution tools.

Generating migrations from visual diffs reduces syntax errors and ensures that all foreign key constraints and column defaults align with the architectural model before generating code.

How to run a migration script?

Running a migration script involves executing the generated DDL against a target database engine and recording the execution in a dedicated metadata history table that acts as an audit trail of every change applied to the schema[3]. Deployment execution typically occurs through automated CI/CD runners or interactive developer tooling.

Execution Workflows in Automated Pipelines

  • Validate migration files: Verify file checksums against previously executed scripts to prevent out-of-order execution or modified history.
  • Acquire schema lock: Lock the metadata history table (such as DATABASECHANGELOG or flyway_schema_history) to prevent concurrent deployments across clustered application instances.
  • Apply pending DDL: Execute unapplied migration scripts inside transactional blocks where supported by the database engine.
  • Record execution metadata: Insert a new row containing the migration version, execution timestamp, file checksum, and deployment status.

Automated CLI runners execute migrations sequentially in pipelines, but they offer limited visibility when unexpected drift occurs in staging or production.

DbSchema provides visual deployment control through interactive schema synchronization. You open the local design model, connect to the target database, and inspect every difference side by side. For every discrepancy, you choose whether to deploy the change to the live database, update your design model, or ignore the difference, converting the diff into a safe migration script.

What are the three data migration tools available?

Database change management falls into three distinct operational approaches: visual schema modelers, changelog-driven orchestrators, and SQL-first CLI migration engines. Selecting the right tool depends on whether your team prioritizes visual design, multi-engine abstraction, or lightweight script execution.

ToolPrimary ApproachSupported EnginesArtifact FormatCore Interface
DbSchemaVisual model comparison and live schema synchronization100+ SQL and NoSQL engines.dbs XML model and native SQL scriptsInteractive GUI and Groovy automation scripts
LiquibaseChangelog orchestration and multi-format abstractions65+ database typesXML, YAML, JSON, and formatted SQLCLI, Maven/Gradle plugins, and CI/CD integrations
FlywaySQL-first versioned script execution20+ SQL engines and native connectorsPlain SQL files with strict version prefixesCLI, Maven/Gradle plugins, and Java API

DbSchema: Visual Synchronization and Offline Modeling

DbSchema leads with an offline-first visual design workflow. Developers design schemas on interactive ER diagrams, track changes in XML model files in Git, and run bi-directional schema comparisons against live databases to generate migration scripts.

Liquibase: Declarative Changelog Orchestration

Liquibase provides an abstraction layer that allows teams to declare schema modifications in XML, YAML, JSON, or SQL changeSets, with the changelog file extension determining the format[2]. It automatically handles cross-database syntax variations and executes changes through command-line workflows.

Flyway: Lightweight SQL-First Migrations

Flyway relies directly on plain SQL files organized by version prefixes, where each versioned migration carries a unique version, a description, and a checksum[1]. It favors simplicity over format abstractions, executing migrations sequentially against the target catalog using lightweight CLI or JVM plugins.

Is Liquibase a database migration tool?

Liquibase is a dedicated open-source database migration and change management tool designed to track, manage, and automate schema updates, with Liquibase Community licensed under the Functional Source License[6]. It automates database updates by executing declarative changelogs across a broad catalogue of relational, NoSQL, and graph databases[7].

Liquibase Community vs. Liquibase Secure

Liquibase distributes its software across an open-source community tier and a commercial enterprise distribution with differing capabilities[6].

  • Liquibase Community: Open-source engine providing core changelog execution, basic diff capabilities, and multi-format support (XML, YAML, JSON, SQL) under the Functional Source License (FSL)[6].
  • Liquibase Secure: Enterprise tier adding governance features such as policy compliance checks and drift reporting, plus credential vault integrations and audit history[8].
  • Runtime Requirements: Advanced object types such as check constraints, functions, stored procedures, and triggers are only inspected in the commercial Secure edition[2].
  • Ecosystem Integration: Operates via CLI, GitHub Actions, Jenkins, Maven, and Gradle plugins for CI/CD integration.

Liquibase fits teams requiring strict compliance policies and database-agnostic changelogs, but it requires developers to manage complex XML or YAML hierarchies instead of inspecting visual schema diffs.

Which tool is best for data migration?

Selecting the best tool depends on whether your workflow centers on visual schema architecture, universal database administration, or text-based diagram documentation.

ToolPrimary StrengthDesign WorkflowMigration CapabilitiesLicense Model
DbSchemaVisual ER design, offline Git models, and interactive live synchronizationInteractive graphical ER diagrams with visual foreign keys and validationGenerates DDL migration scripts directly from visual and live database diffsFree Community Edition; Commercial Pro and Architect Editions
DBeaverUniversal database administration, SQL querying, and data browsingLive catalog metadata browsing with auto-generated entity diagramsBasic SQL script execution without automated model-to-database diff scriptsFree Community Edition (Apache 2.0); Commercial PRO with NoSQL and Cloud support
dbdiagram.ioFast DBML-to-ERD diagramming for documentationBrowser-based code editor using open-source DBML syntaxExports raw forward SQL DDL; no live database synchronization or drift diffingFree tier; commercial team collaboration subscriptions

Evaluating GUI Clients and Diagram Tools

Universal GUI clients like DBeaver offer broad database connectivity and query editing, but their focus remains administrative data browsing rather than managing schema diffs and generating versioned migrations.

Browser-based diagramming tools like dbdiagram.io have rendered over 3 million diagrams via DBML code[9]. While DBML provides a clean DSL for documenting tables, it operates purely in the browser without live database introspection, multi-environment synchronization, or automated migration script generation.

Backend developers need a solution that bridges visual architectural design with deployable migration scripts, eliminating the manual translation step between diagramming and DDL execution.

What is the best tool for data migration?

DbSchema Pro Edition provides the best end-to-end workflow for backend developers by combining visual ER modeling, offline Git collaboration, and live schema synchronization in one desktop application schema migration tools. It removes the friction of hand-writing DDL for complex table alterations while keeping full control over the generated migration scripts.

End-to-End Migration Architecture

  • Design offline safely: Build and modify schemas on visual ER diagrams without maintaining a persistent database connection.
  • Version models in Git: Store your schema design in a.dbs XML file that diffs and merges cleanly in pull requests.
  • Compare against live environments: Connect to development, staging, or production databases to inspect discrepancies side by side.
  • Generate and review DDL: Produce targeted migration scripts containing only the required ALTER, CREATE, and DROP statements.
  • Automate execution: Integrate migration scripts into CI/CD pipelines alongside platforms like Bytebase or CLI runners for governed releases[5].

Download DbSchema at dbschema.com/download.html, open your database connection to reverse-engineer your existing schema, and compare the visual model against your staging database. DbSchema Community Edition provides free ER diagramming and SQL editing across all databases, while DbSchema Pro Edition delivers full schema synchronization, migration script generation, and team Git workflows.

Frequently asked questions

Which tool is best for data migration?

For developers who want to design visually and version changes in Git, DbSchema Pro Edition is the best choice. It compares your offline XML model to the live database and generates the migration script. Pure code-first teams often rely on Flyway or Liquibase.

Is Liquibase a database migration tool?

Yes. Liquibase tracks, manages, and applies database changes using an abstracted changelog (XML, YAML, JSON, or SQL). It supports over 65 database types and requires a minimum of Java 17 for version 5.0.

What are the three data migration tools available?

Three leading tools are DbSchema for visual schema synchronization, Liquibase for complex orchestration across 65 database types, and Flyway for a straightforward SQL-based approach across 20 SQL engines.

What is the best tool for data migration?

The best tool depends on your workflow. DbSchema leads for visual database management and Git-based XML diffs. Flyway is ideal for teams writing raw SQL, while Liquibase suits standardizing rollouts across diverse database ecosystems.

How to generate a migration file?

You can generate a migration file automatically by comparing two schema states. In DbSchema, you compare the Git-versioned XML design model against a live database, review the missing columns or new tables, and export the resulting SQL migration script.

What is a migration script?

A migration script is a SQL file containing commands like CREATE and ALTER that update a database from one structure version to the next. It ensures that schema changes are reproducible across development, test, and production environments.

How to run a migration script?

Migration scripts are run through a CLI, a CI/CD pipeline, or a management GUI. The tool connects to the target database and executes the SQL statements sequentially, applying the schema changes safely without manual intervention.

Sources

  1. documentation.red-gate.com
  2. docs.liquibase.com
  3. documentation.red-gate.com
  4. liquibase.com
  5. bytebase.com
  6. github.com
  7. liquibase.com
  8. docs.liquibase.com
  9. dbdiagram.io
  10. dbeaver.io

Turn a schema diff into a migration script

DbSchema compares your offline .dbs model against a live database, lists every difference side by side, and generates the DDL for you to review before it runs. Schema synchronization is a Pro Edition feature; the free Community Edition covers reverse-engineering, interactive diagrams and the SQL editor.

DbSchema Design your database visually - free

DbSchema ER Diagram Download free
Visual Design & Schema Diagram

✓ Create and manage your database schema visually through a user-friendly graphical interface.

✓ Easily arrange tables, columns, and foreign keys to simplify complex database structures, ensuring clarity and accessibility.

GIT & Collaboration
Version Control & Collaboration

✓ Manage schema changes through version control with built-in Git integration, ensuring every update is tracked and backed up.

✓ Collaborate efficiently with your team to maintain data integrity and streamline your workflow for accurate, consistent results.

Data Explorer & Query Builder
Relational Data & Query Builder

✓ Seamlessly navigate and visually explore your database, inspecting tables and their relationships.

✓ Build complex SQL queries using an intuitive drag-and-drop interface, providing instant results for quick, actionable insights.

Interactive Documentation & Reporting
HTML5 Documentation & Reporting

✓ Generate HTML5 documentation that provides an interactive view of your database schema.

✓ Include comments for columns, use tags for better organization, and create visually reports.