All articles
GuidesNovember 13, 2026·8 min read

Database Porting: What Actually Has to Move When You Change DBMS

DBShifts Engineering

The team building DBShifts

Database porting is moving a working database to a different database management system — MySQL to PostgreSQL, SQL Server to MySQL, Oracle to PostgreSQL, a relational database to MongoDB — so that the application on top keeps working. People search for it as porting, as a database transfer, or as migrating to another DBMS; the work is the same. What makes it different from copying a database to a new server is that the two systems do not speak the same language, so everything has to be translated, and some of it silently changes meaning on the way.

It helps to stop thinking of it as one job. A port is five, and they fail in different ways.

1. The schema

Tables, columns, keys, indexes and constraints have to be rewritten in the target's dialect, and every column type needs a target type. Most map directly. The ones that do not are where ports go wrong: an INT UNSIGNED needs a wider signed integer on PostgreSQL or SQL Server or its top half overflows, a MySQL ENUM becomes its own type on PostgreSQL but free text on SQL Server or Oracle (the list of allowed values is gone), TINYINT(1) is a boolean in spirit and a small integer to the engine, and an auto-increment key becomes a sequence, an identity or a SERIAL, each with its own rules.

You can see this for your own tables before touching a database: paste MySQL CREATE TABLE statements into the free schema converter and it returns the PostgreSQL, SQL Server, Oracle or SQLite DDL a migration would create, with every column whose type widens, changes meaning or can lose data listed.

2. The data

Copying rows sounds like the easy part and is where the quiet damage happens. A value that does not fit the target type is clipped, rounded or truncated, and most tools report success anyway. Dates outside the target's range, text in a different character set, NUMERIC values with more digits than the target keeps, and empty strings on an engine that treats them as NULL (Oracle) all survive the copy and come out different.

The only defence is to check after copying: not just that the row counts match, but that the values do. That means a checksum per table computed the same way on both sides, which is harder than it sounds when the two engines print the same number differently — see why row counts are not enough. If the source cannot stop taking writes while you copy, you also need to catch up the changes made in the meantime (change data capture) and switch over when the two are in step.

3. The SQL in your application

Every query the application sends was written for the old engine. Some fail loudly on the new one, which is the good case: IFNULL, GROUP_CONCAT, backtick quoting, LIMIT 20, 10. The dangerous ones still run and return something else: string comparisons that stop ignoring case, NULLs that sort to the other end, integer division that stops returning decimals, an UPDATE … LIMIT with no equivalent. The SQL query converter rewrites the first kind and flags the second, one statement at a time; in a migration project DBShifts finds the SQL in your source code and does the same for all of it.

4. The code inside the database

Stored procedures, functions and triggers are written in the old engine's procedural language — PL/SQL, T-SQL, MySQL's stored-program dialect — and the new engine has its own. Simple ones convert by rule; anything with cursors, dynamic SQL, packages or engine-specific error handling needs a person. Count them before you plan: a schema with three triggers and a schema with four hundred packages are different projects with the same name.

5. The behaviour nobody wrote down

Collation decides whether 'a' = 'A'. Isolation levels decide what a concurrent reader sees. Default time zones decide what NOW() returns. Identifier case folding decides whether Users and users are one table or two. None of these are in the schema file, and the application depends on all of them. Write down what the old database does for each before you switch, then test the same cases on the new one.

How hard each port is

  • MySQL ↔ MariaDB — the closest pair: the same protocol and mostly the same types. The differences are in newer features (JSON is a native type on MySQL and an alias for text on MariaDB) and in defaults. MySQL to MariaDB
  • MySQL → PostgreSQL — types map well; the work is unsigned integers, ENUMs, case-insensitive comparisons the application relied on, and the query dialect. MySQL to PostgreSQL
  • SQL Server → PostgreSQL or MySQL — T-SQL procedures, NVARCHAR and identity columns, and a case-insensitive default collation the application may depend on without knowing it. SQL Server to PostgreSQL, SQL Server to MySQL
  • Oracle → PostgreSQL or MySQL — usually the hardest relational port: PL/SQL packages, NUMBER without a declared precision, and empty strings that Oracle stores as NULL. Oracle to PostgreSQL, Oracle to MySQL
  • A relational database ↔ MongoDB — a change of model, not just of dialect: tables become documents, joins become embedding or references, and the application's data access is rewritten. Oracle to MongoDB, MongoDB to PostgreSQL

A porting checklist

  • Inventory: tables, rows, the largest tables, stored procedures, triggers, views, and every application that connects.
  • Convert the schema and read every column the conversion flags before anything else.
  • Find the SQL in the application and convert it; test the statements flagged as behaving differently, not just the ones that fail.
  • Rehearse: run the whole port against a copy of production (masked, if it holds personal data) and time it.
  • Verify every table with row counts and checksums, not by spot-checking.
  • Plan the switch: either stop writes for the copy, or keep the two in step with change data capture and cut over when they match.
  • Keep a way back: until the new database has run in production for a while, know how you would return.
DBShifts does this as one project: it converts the schema, copies the data, verifies every table with checksums, keeps the target in step with change data capture until you switch, and can roll back. The migration paths page lists all 49 engine pairs it is tested on.

Migrate with the platform behind these posts

All 49 engine pairs live-tested. Validation, rollback, and CDC built in.

Start Free Migration