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:

cidnametypenotnulldflt_valuepk
0idINTEGER00
1recipient_idINTEGER00
2sender_idINTEGER00
3noteTEXT00
4amountREAL00

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.