Playlistr: Migrate Create
Let's define us a database table!
Migrate Create
With the commandbox-migrations
module in place and configured, we can now start to create a migration script. These scripts are used to modify your database tables and columns.
A simple migrate create artists
will create the directory ./resources/database/migrations/
and place a migration template file name yyyy_mm_dd_hhmmss_artists.cfc
.
With this boilerplate file we can modify it to build our artists
table.
The up()
method is called by the migrate up
and down()
is called by migrate down
.
In this first example we have hand written the SQL
to create and drop our table. Later you we will use qb
to perform our database interactions.
Now we have a way to build our artists
table and tear it down in a predicable and consistent manner using migrate up
and migrate down
.