We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Up Migration

To manage migrations, we use a simple system based on up and down directions.

  • The up migration applies changes to move your schema forward.
  • The down migration rolls those changes back to the previous state.

This allows developers to safely move between versions of the schema during development and production rollouts.

Let's write the SQL for an up migration to add new features to our database.

Assignment

We're going to add more columns to the transactions table. We need to know whether or not each transaction between two users was successfully completed. Our database should also track the type of transaction.

The transactions table looks like this at the moment:

cid name type notnull dflt_value pk
0 id INTEGER 0 0
1 recipient_id INTEGER 0 0
2 sender_id INTEGER 0 0
3 note TEXT 0 0
4 amount REAL 0 0

Complete the following SQL statements in this order:

BOOL is technically valid, but the assignment expects BOOLEAN – so use BOOLEAN instead of BOOL to pass.