Flexing Make

This is a premium course, which you can purchase below.

Buy Now

I love using Make, especially when it comes to working with my database.


Make is an old tool with one job: orchestrate shell commands. It's used to build things, and is the oldest build tool there is. We can use this power to build out our database!

rebuild: dev change schema migrate

migrate:
  rails db:migrate

schema:
  rails db:schema:dump

dev:
  psql -q railz\_development < db.sql

change:
  psql -q railz\_development < change.sql


.PHONY: dev change migrate schema db

This file will run the commands in order, creating our dev database, running our SQL scripts, and finally any migrations.