

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 3
click for more info
Not enough gems
Cost: 6 gems
1: Creating a Table
incomplete
2: Create Table Practice
incomplete
3: Altering Tables
incomplete
4: Intro to Migrations
incomplete
5: Up Migration
incomplete
6: Down Migration
incomplete
7: Migration Review
incomplete
8: SQL Data Types
incomplete
9: Practice – Posts Table
incomplete
10: Practice – Posts Table Migration
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
The migration we applied ended up causing trouble in production! It's possible the app wasn't ready for the new columns.
In situations like this, we need to roll back the changes safely using a down migration.
Down migrations allow us to:
A well-written down migration should completely reverse the changes made in the up migration. In our case, that means removing the two columns we just added.
For example, to remove a column you can use the DROP COLUMN command:
ALTER TABLE users
DROP COLUMN email;
Click to play video
Complete the following down migration:
This will revert the schema to the original state.