# Install pgloader
# Ubuntu/Debian
sudo apt-get install pgloader
# macOS
brew install pgloader
# Create a conversion file (convert.load)
LOAD DATABASE
FROM mysql://xata_migration:password@your-mysql-host/your_database
INTO postgresql://your-xata-connection-string
WITH include drop, create tables, create indexes, reset sequences,
workers = 8, concurrency = 1,
multiple readers per thread, rows per range = 50000
SET MySQL PARAMETERS
net_read_timeout = '600',
net_write_timeout = '600'
SET PostgreSQL PARAMETERS
maintenance_work_mem to '128 MB',
work_mem to '12 MB',
search_path to 'public'
CAST
type int with extra auto_increment to serial,
type int with extra auto_increment to bigserial when (> precision 10),
-- Add more type conversions as needed
default value null for drop typemod keep default keep not null;
# Run the conversion
pgloader convert.load