Set the ENV variable ROSETTA_DRIVERS to point to the location of your JDBC drivers.
export ROSETTA_DRIVERS=<path_to_jdbc_drivers>
example:
export ROSETTA_DRIVERS=/Users/adaptivescale/drivers/*
- Download the rosetta binary for the supported OS (releases page).
rosetta-<version>-linux-x64.zip rosetta-<version>-mac_aarch64.zip rosetta-<version>-mac_x64.zip rosetta-<version>-win_x64.zip - Unzip the downloaded file
- Run rosetta commands using
./rosettawhich is located insidebindirectory. - Create new project using
rosetta initcommand:
rosetta init database-migration
The rosetta init command will create a new rosetta project within database-migration directory containing the main.conf (for configuring the connections to data sources).
- Configure connections in
main.confexample: connections for postgres and mysql
# If your rosetta project is linked to a Git repo, during apply you can automatically commit/push the new version of your model.yaml
# The default value of git_auto_commit is false
git_auto_commit: false
connections:
- name: mysql
databaseName: sakila
schemaName:
dbType: mysql
url: jdbc:mysql://root:sakila@localhost:3306/sakila
userName: root
password: sakila
- name: pg
databaseName: postgres
schemaName: public
dbType: postgres
url: jdbc:postgresql://localhost:5432/postgres?user=postgres&password=sakila
userName: postgres
password: sakila
- Extract the schema from postgres and translate it to mysql:
rosetta extract -s pg -t mysql
The extract command will create two directories pg and mysql. pg directory will have the extracted schema
from Postgres DB. The mysql directory will contain the translated YAML which is ready to be used in MySQL DB.
- Migrate the translated schema to MySQL DB:
rosetta apply -s mysql
The apply command will migrate the translated Postgres schema to MySQL.
- Download the rosetta CLI JAR (releases page)
- Create an alias command
alias rosetta='java -cp "<path_to_our_cli_jar>:<path_to_our_drivers>" com.adaptivescale.rosetta.cli.Main'example:
alias rosetta='java -cp "/Users/adaptivescale/cli-1.0.0.jar:/Users/adaptivescale/drivers/*" com.adaptivescale.rosetta.cli.Main'Note: If we are using the cli JAR file, we need to specify the location of the JDBC drivers (directory). See the Getting Started section.
gradle binary:runtimeZip