Tool to track SQL schema like infrastructure as code?


April 2019


52 time


I have been using AWS Cloudformation and Terraform to manage cloud infrastructure as code (IAC). The benefits are obvious.

1) Template file to concisely describe your infrastructure 2) Versioning 3) Rollbacks

I also have a PostgreSQL DB where I can dump the schema into a single file. Now, it would be amazing if I could edit a dumped SQL file like I do a (IFC) template. I could then validate my new SQL template and apply changes to my DB with the same workflow as Cloudformation or Terraform.

Does anyone know if a tool like this exists for any of the various SQL providers?

1 answers


Have you given Flyway a try?

It supports versioning database migrations as well as rolling back and undoing migrations when needed. It also keeps a schema table in the database that tracks which migrations have been applied to that database, so that you can continuously deploy new scripts and changes to an existing application that is using Flyway.