The New Default. Your hub for building smart, fast, and sustainable AI software

See now

Database Migration

Database migration is the process of transferring data and schema from one database system or environment to another.

What Is Database Migration?

Database migration is the project that gets application data safely from an old database system to a new one, without losing records or breaking the application that depends on them. Applications need this for reasons unrelated to the data: a vendor changes its pricing, a team needs a feature only available on a different engine, or a merger forces two companies running duplicate systems to become one.

The work goes beyond copying rows. A migration usually reshapes the schema to fit the target system's data types and constraints, checks that every row arrived intact, and coordinates a cutover moment when the application starts reading and writing to the new database instead of the old one.

Migrations range from a same-vendor version upgrade that takes an afternoon to a cross-vendor move, for example MySQL to PostgreSQL, that takes months of parallel testing before the old system can be switched off.

Why Does Database Migration Matter?

  • The database a team picks at launch rarely fits the company five years later. Traffic can grow past what the original engine handles well. Compliance requirements can rule out the current hosting setup. A vendor discontinuing the pricing tier the product depends on has the same effect: migration lets the product keep pace without a rewrite.

  • Staying on an unsupported or under-scaled database has an ongoing cost. Slow queries show up as slow product features, and a database past its vendor's support window stops receiving security patches. This turns routine maintenance into a compliance gap.

  • Mergers and acquisitions force consolidation. Two companies rarely run the same database setup, and keeping both alive after a merger doubles the licensing and hosting cost.

How Does Database Migration Work?

  • The team first audits the source database. This means cataloging schema, data volume, indexes, stored procedures, and every application or service that reads from or writes to it. Anything missed here surfaces as a production incident later.

  • Schema mapping converts structure for the target system. Data types and constraints rarely translate one-to-one across database engines. This step decides how each source structure becomes a target structure.

  • The team picks a migration pattern. A one-time bulk transfer works for systems that can tolerate a maintenance window. For a live system that cannot go offline, change data capture (CDC) replicates ongoing writes while the bulk transfer runs in the background.

  • Data moves in batches, with validation at each step. Row counts and checksums confirm that what landed in the target matches what left the source, instead of trusting the transfer tool's success message alone.

  • Cutover redirects the application to the new database. This is usually the shortest step in calendar time and the highest-risk one. It is the moment production traffic starts depending on the new system working.

  • The old system stays available for a rollback window. Teams keep the source database running and synchronized for days after cutover, so they can reverse a problem discovered after go-live.

What Tools Do Teams Use for Database Migration?

  • Managed migration services move data between specific source and target engines with less custom scripting. AWS Database Migration Service, Google Cloud Database Migration Service, and Azure Database Migration Service each handle schema conversion and ongoing replication for their respective cloud platforms.

  • Change data capture tools replicate database writes in near real time, making near-zero-downtime migrations possible. Debezium and Fivetran both stream row-level changes from a source database to a target as they happen.

  • Schema and data-loading tools handle the structural and one-time transfer side of the work. Flyway and Liquibase version-control schema changes across environments, and pgloader automates bulk data transfer and type conversion between specific database engines.

What Are the Key Characteristics of Database Migration?

  • A defined downtime model. Every migration commits to either an offline window, where the application is unavailable during the transfer, or an online approach using CDC, where the application keeps running while data replicates in the background.

  • Schema transformation logic. Moving between database engines means converting data types and constraints.

  • Validation against the source. A migration is complete once row counts or checksums confirm the target matches the source.

  • A rollback plan. The source database stays live and synchronized for a defined window after cutover. It lets the team revert if the new system misbehaves under production load.

  • A cutover moment. At some point, application traffic switches from reading and writing the old database to reading and writing the new one. It can happen all at once or gradually through a feature-flagged rollout.

What Are the Benefits of Database Migration?

  • Removes dependence on a single vendor. Moving data to a database engine with an open specification or wider hosting support gives a team room to change providers again later.

  • Improves performance at the new scale. A database engine chosen for a five-person startup often cannot handle the query patterns or data volume of the same product three years later. Migration helps the underlying system catch up to the product.

  • Cuts infrastructure cost. Consolidating multiple databases into one, or moving off an expensive proprietary license to an open-source engine, reduces recurring hosting and support costs.

  • Closes compliance gaps. A database past its vendor's end-of-support date stops receiving security patches. Migrating to a supported version or engine restores the patching cadence auditors expect.

  • Unlocks features the old engine lacks. Full-text search or native JSON support are common reasons teams move to a newer engine.

What Are the Challenges of Database Migration?

  • Zero-downtime tooling adds its own complexity. Change data capture removes the need for a maintenance window, but it means keeping two databases synchronized and building a cutover process that correctly handles in-flight transactions.

  • Schema incompatibility forces trade-offs. Data types that exist in one engine and not another, for example, MySQL's ENUM type moving to PostgreSQL, need a conversion decision that changes how the application queries that column afterward.

  • Validation gets slower as data grows. Row-by-row checksum comparison is the most reliable way to catch a bad transfer, but at large data volumes it takes long enough that teams fall back to sampling, which carries a small risk of missing a corrupted row.

  • Application code often needs temporary changes. Dual-write logic or read routing that sends some traffic to the new database and some to the old one adds short-term complexity. Remove it cleanly after cutover, or it becomes permanent technical debt.

What Is the Difference Between Database Migration and Cloud Migration?

Aspect

Database Migration

Cloud Migration

Scope

The data and schema inside one or more databases

The entire application stack, including compute, storage, networking, and often the database

Typical trigger

Changing database vendor or version, or consolidating systems

Moving from on-premises infrastructure to the cloud, or between cloud providers

Data movement

Always the primary activity

Optional; a lift-and-shift may leave data structures untouched

Relationship

Can happen independently of any infrastructure change

Frequently includes a database migration as one work stream among several

Primary tooling

AWS DMS, Debezium, pgloader

Cloud provider migration hubs, infrastructure-as-code tools

Example

Moving a production database from MySQL to PostgreSQL on the same server

Moving an application, database included, from a private data center to a cloud provider

FAQ About Database Migration

Need expert help with Database Migration?

Monterail builds custom software solutions that leverage the latest technologies. Let's discuss how we can help with your project.

GET IN TOUCH