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:
- Analyzes source table structures
- Maps data types between source and target databases
- Creates corresponding tables in the target database
- 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 Type | PostgreSQL Type |
---|---|
TINYINT | SMALLINT |
SMALLINT | SMALLINT |
MEDIUMINT | INTEGER |
INT/INTEGER | INTEGER |
BIGINT | BIGINT |
FLOAT | REAL |
DOUBLE | DOUBLE PRECISION |
DECIMAL | NUMERIC |
CHAR | CHAR |
VARCHAR | VARCHAR |
TEXT | TEXT |
DATETIME | TIMESTAMP |
TIMESTAMP | TIMESTAMP |
DATE | DATE |
TIME | TIME |
BOOLEAN/TINYINT(1) | BOOLEAN |
JSON | JSONB |
PostgreSQL to MySQL
PostgreSQL Type | MySQL Type |
---|---|
SMALLINT | SMALLINT |
INTEGER | INT |
BIGINT | BIGINT |
REAL | FLOAT |
DOUBLE PRECISION | DOUBLE |
NUMERIC/DECIMAL | DECIMAL |
CHAR | CHAR |
VARCHAR | VARCHAR |
TEXT | TEXT |
TIMESTAMP | DATETIME |
DATE | DATE |
TIME | TIME |
BOOLEAN | TINYINT(1) |
JSONB/JSON | JSON |
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 targetnoCreateIndexes
: Skip index creation for specified tablesschema
: Specify target schema (PostgreSQL only)
Primary Keys and Indexes
By default, DBConvert Streams:
- Preserves primary key definitions
- Creates corresponding indexes in the target database
- Maintains foreign key relationships when possible
To skip index creation for specific tables, use the noCreateIndexes
option.