wheels dbmigrate - commands
These are the commands in the wheels dbmigrate
namespace. They allow you to manipulate the database structure and script the changes. This makes is easy to share your changes with coworkers, check them into source control, or apply them automatically when you deploy your code to production.
wheels dbmigrate
wheels dbmigrate
This is another namespace with sub commands within it. It also has an alias of wheels db
which allows you to shorten the command you need to type.
wheels dbmigrate info
wheels dbmigrate info
This command doesn't take any inputs but simply tries to communicate with the running server and gather information about your migrations and displays them in a table.
From the information presented in the two tables you can see how many migration files are in your application and of those how many have already been applied and available to be applied. You are also presented with the datasource name and database type information.
wheels dbmigrate latest
wheels dbmigrate latest
This command will migrate the database to the latest version. This command will apply each migration file from the current state all the way to the latest one at a time. If a SQL error is encountered in one of the files, the command will stop at that point and report the error.
wheels dbmigrate reset
wheels dbmigrate reset
This command will migrate the database to version 0 effectively resetting the database to nothing.
wheels dbmigrate up
wheels dbmigrate up
This command will process the next migration file from the current state. If the database is already at the latest version this command will have no effect.
wheels dbmigrate down
wheels dbmigrate down
This command will reverse the current migration file and take the database one step backwards. If the database is already at version 0 then this command will have no effect.
wheels dbmigrate exec
wheels dbmigrate exec
This command will run a particular migration file and take the database to that version. The four directional migration commands above latest
, reset
, up
, and down
each in turn call this command to process their intended action.
wheels dbmigrate create table
wheels dbmigrate create table
This command will generate a new migration file for creating a table in the database. Keep in mind you will still have to run the migration file but this will add it to the migration history.
wheels dbmigrate create column
wheels dbmigrate create column
This command will generate a new migration file for adding a new column to an existing table.
wheels dbmigrate create blank
wheels dbmigrate create blank
wheels dbmigrate remove table
wheels dbmigrate remove table
This command generates a migration file to remove a table. The migration file is will still need to be run individual but this command gets the migration generated and into the history.
Last updated