{"repo":"choonkeat/dbmigrate","free":true,"listed":false,"github":"https://github.com/choonkeat/dbmigrate","clone":"git clone https://github.com/choonkeat/dbmigrate.git","description":"rails migrate inspired approach to database schema migrations but with plain sql files. and much faster.","language":"Go","stars":10,"topics":["golang","database","migration-tool","postgresql","mysql","mariadb","sql"],"license":"MIT","category":"databases-storage","readme_excerpt":"dbmigrate rails migrate inspired approach to database schema migrations but with plain sql files. and much faster. Getting started with docker-compose Given a working app Let's say we have a simple docker-compose project setup with only a docker-compose.yml file That declares a postgres database ( mydb ) and an app ( myapp ) that uses the database somehow (in our contrived example, we're just listing the tables in our database with \\dt ) Let's see how our app runs The output simply shows that - our myapp waited until mydb:5432 was ready to accept connections - then it listed the tables inside the database and got Did not find any relations (which means no tables) Add dbmigrate Now let's add dbmigrate to our docker-compose.yml (take special note that myapp has a new entry under depends on also) And we can start creating a few migration scripts by running docker-compose up dbmigrate with a custom DBMIGRATE CMD env variable After running those 2 commands, we see that we've generated 2 pairs of empty .up.sql and .down.sql files. We add our SQLs into our respective files Database schema migrations is now managed Let's see how our app runs after those changes Hey, looks like we have 3 tables now: 1. blogs created by our db/migrations/20190601085814 blogs.up.sql 1. users created by our db/migrations/20190601085805 users.up.sql 1. dbmigrate versions created by dbmigrate for itself to track migration history. - every time dbmigrate runs, it checks dbmigrate versions table to know whic","default_branch":null,"files":null,"tree":[],"storefront":"/r/choonkeat","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/choonkeat/dbmigrate/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}