Skip to content

Table Structure Conversion

Overview

DBConvert Streams provides automatic table structure conversion between different database types, enabling seamless heterogeneous data migration. When you create a stream with createStructure: true, the system automatically:

  1. Analyzes source table structures
  2. Maps data types between source and target databases
  3. Creates corresponding tables in the target database
  4. Sets up appropriate indexes and constraints

Supported Conversions

Current database type conversion paths:

  • MySQL → PostgreSQL
  • PostgreSQL → MySQL
  • MariaDB → PostgreSQL
  • PostgreSQL → MariaDB

Data Type Mapping

DBConvert Streams automatically maps data types between databases using the following principles:

MySQL to PostgreSQL

MySQL TypePostgreSQL Type
TINYINTSMALLINT
SMALLINTSMALLINT
MEDIUMINTINTEGER
INT/INTEGERINTEGER
BIGINTBIGINT
FLOATREAL
DOUBLEDOUBLE PRECISION
DECIMALNUMERIC
CHARCHAR
VARCHARVARCHAR
TEXTTEXT
DATETIMETIMESTAMP
TIMESTAMPTIMESTAMP
DATEDATE
TIMETIME
BOOLEAN/TINYINT(1)BOOLEAN
JSONJSONB

PostgreSQL to MySQL

PostgreSQL TypeMySQL Type
SMALLINTSMALLINT
INTEGERINT
BIGINTBIGINT
REALFLOAT
DOUBLE PRECISIONDOUBLE
NUMERIC/DECIMALDECIMAL
CHARCHAR
VARCHARVARCHAR
TEXTTEXT
TIMESTAMPDATETIME
DATEDATE
TIMETIME
BOOLEANTINYINT(1)
JSONB/JSONJSON

Configuration

Example : Skipping Index Creation

json
{
    "name": "skip_indexes_stream",
    "source": "conn_source",
    "target": "conn_target",
    "mode": "convert",
    "createStructure": true,
    "tables": [
        {
            "name": "large_table"
        }
    ],
    "target": {
        "options": {
            "tables": [
                {
                    "name": "large_table",
                    "noCreateIndexes": true
                }
            ]
        }
    }
}

Available target options:

  • createStructure: Create table structure on target
  • noCreateIndexes: Skip index creation for specified tables
  • schema: Specify target schema (PostgreSQL only)

Primary Keys and Indexes

By default, DBConvert Streams:

  1. Preserves primary key definitions
  2. Creates corresponding indexes in the target database
  3. Maintains foreign key relationships when possible

To skip index creation for specific tables, use the noCreateIndexes option.

DBConvert Streams - event driven replication for databases