Skip to main content

hydra migrate sql

hydra migrate sql

Create SQL schemas and apply migration plans


Run this command on a fresh SQL installation and when you upgrade Hydra to a new minor version. For example, upgrading Hydra 0.7.0 to 0.8.0 requires running this command.

It is recommended to run this command close to the SQL instance (e.g. same subnet) instead of over the public internet. This decreases risk of failure and decreases time required.

You can read in the database URL using the -e flag, for example: export DSN=... hydra migrate sql -e


Before running this command on an existing database, create a back up!

hydra migrate sql <database-url> [flags]


  -h, --help            help for sql
-e, --read-from-env If set, reads the database connection string from the environment variable DSN or config file key dsn.
-y, --yes If set all confirmation requests are accepted without user interaction.

Options inherited from parent commands

  -c, --config strings   Path to one or more .json, .yaml, .yml, .toml config files. Values are loaded in the order provided, meaning that the last config file overwrites values from the previous config file.