● videoThe Rewrite
Flexing Make

Unlock Revisiting Ruby on Rails
Subscribe for full access to every course, or buy this one on its own.
SECTION
The Rewrite
NEXT UP
Using Scaffold With Existing Data
COURSE
Rails Revisited
33 lessons
About this lesson
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!
<span class="hljs-section">rebuild: dev change schema migrate</span>
<span class="hljs-section">migrate:</span>
rails db:migrate
<span class="hljs-section">schema:</span>
rails db:schema:dump
<span class="hljs-section">dev:</span>
psql -q railz\_development < db.sql
<span class="hljs-section">change:</span>
psql -q railz\_development < change.sql
<span class="hljs-meta"><span class="hljs-keyword">.PHONY</span>: dev change migrate schema db</span>
This file will run the commands in order, creating our dev database, running our SQL scripts, and finally any migrations.
Unlock Revisiting Ruby on Rails
Subscribe for full access to every course, or buy this one on its own.