Skip to content

A radical tool for converting MySQL database dumps for use with CockroachDB

License

Notifications You must be signed in to change notification settings

LUSHDigital/radroach

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Radroach License Go Report Card

A radical tool for converting MySQL database dumps for use with CockroachDB

Installation

Install as you would a normal package:

go get -u github.com/LUSHDigital/radroach

Usage

Firstly you must have a pre-prepared MySQL dump ready for conversion. Radroach requires you to have created this using mysqldump with some specific options:

mysqldump -h[host] -u[user] -p[database name] --compatible=postgresql --compact --skip-add-drop-table --skip-add-locks --skip-comments > dump.sql

Opinionated I know but it makes our lives much easier

To generate a MySQL dump for a MySQL table hosted in Docker, use the following steps:

  • Jump into the MySQL Docker container shell:
docker exec -it <CONTAINER> /bin/bash
  • Run mysqldump as outlined above.

  • Copy the file/contents of dump.sql and use that as the input to radroach.

Then you just need to run radroach passing it your source file and the name of the destination file:

radroach [FLAGS...] SOURCE_MYSQL_DUMP DESTINATION_CRDB_DUMP

Full Usage

Usage: radroach [FLAGS...] SOURCE_MYSQL_DUMP DESTINATION_CRDB_DUMP
  -enum-to-check
    	convert enums to check constraints
  -verbose
    	verbose logging mode

Roadmap

  • Load MySQL dump
  • Simple regex replacements for types and syntax
  • Break dump down by table, extract foreign keys
  • Re-write dump with foreign keys after table creation
  • Produce a working SQL dump for CockroachDB
  • Refactor codebase for readability and testability
  • Test all the things
  • Cobra cmd support

About

A radical tool for converting MySQL database dumps for use with CockroachDB

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published