To manage migrations, we use a simple system based on up and down directions.
This allows developers to safely move between versions of the schema during development and production rollouts.
Let’s write an up migration to add new features to our database.
Add additional columns to the transactions table. We want to know whether or not the transaction was successfully completed between two users. We also want our database to track the type of transaction.
Our 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 | INTEGER | 0 | 0 |
Complete the following up migration:
BOOLEAN was_successful column to the transactions table.TEXT transaction_type column to the transactions table.BOOL is valid, but the assignment expects BOOLEAN, so use BOOLEAN instead of BOOL to pass this assignment.