Convert database schemas between different database systems. Automatically translates data types, syntax, and database-specific features.
Database migration involves moving your database schema and data from one database system to another. This is common when modernizing applications, changing cloud providers, or optimizing for specific workloads.
One of the most common migrations, often driven by PostgreSQL's advanced features and standards compliance.
| MySQL | PostgreSQL Equivalent |
|---|---|
| AUTO_INCREMENT | SERIAL or IDENTITY |
| TINYINT(1) | BOOLEAN |
| DATETIME | TIMESTAMP |
| BLOB | BYTEA |
| `backticks` | "double quotes" |
| ENGINE=InnoDB | (removed - not needed) |
Common when moving from Windows-based infrastructure to Linux or cloud-native environments.
| SQL Server | PostgreSQL Equivalent |
|---|---|
| IDENTITY(1,1) | SERIAL or IDENTITY |
| BIT | BOOLEAN |
| NVARCHAR | VARCHAR |
| DATETIME2 | TIMESTAMP |
| UNIQUEIDENTIFIER | UUID |
| [square brackets] | "double quotes" |
Often motivated by cost reduction and avoiding vendor lock-in.
| Oracle | PostgreSQL Equivalent |
|---|---|
| NUMBER | NUMERIC or INTEGER |
| VARCHAR2 | VARCHAR |
| DATE | TIMESTAMP (Oracle DATE includes time) |
| CLOB | TEXT |
| RAW | BYTEA |
| SEQUENCE | SERIAL or SEQUENCE |
Convert table definitions, data types, and constraints.
-- MySQL source
CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY,
email VARCHAR(100) UNIQUE
);
-- PostgreSQL target
CREATE TABLE users (
id SERIAL PRIMARY KEY,
email VARCHAR(100) UNIQUE
);
Export data from source and import to target database.
# Export from MySQL
mysqldump -u user -p database > dump.sql
# Import to PostgreSQL (after schema conversion)
psql -U user -d database -f converted_schema.sql
psql -U user -d database -f converted_data.sql
Recreate indexes appropriate for the target database.
-- Create indexes after data import for better performance
CREATE INDEX idx_users_email ON users(email);
CREATE INDEX idx_orders_user_date ON orders(user_id, order_date);
Add foreign keys and constraints after data is loaded.
ALTER TABLE orders
ADD CONSTRAINT fk_orders_user
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
Different databases handle auto-incrementing IDs differently.
Date and time types vary significantly between databases.