The 'status' command

The status command will report the current state of the database. The status command takes no parameters and operates on the current working directory or that specified by the --path option (as with all other commands).

/home/cbegin/testdb$ migrate status
ID             Applied At          Description
==================================================================
20090802210445    ...pending...    create changelog
20090804225328    ...pending...    create blog table

Since we’ve never run a migration, the status of all of the existing migration scripts is pending, including the changelog table itself, which is where more detailed status logs are kept. Once we run the up command (discussed next), the status will report something like the following:

/home/cbegin/testdb$ migrate status
ID             Applied At          Description
==================================================================
20090802210445  2009-08-04 22:51:16  create changelog
20090804225328  2009-08-04 22:51:16  create blog table

Thanks to our identifier format, things are in order, and we can see when a migration script was created, as well as when it was applied. The comment helps us read a high level overview of the evolution of this database. As we add migrations this status log will grow. For example:

/home/cbegin/testdb$ migrate status
ID             Applied At          Description
==================================================================
20090802210445 2009-08-04 22:51:16 create changelog
20090804225207 2009-08-04 22:52:51 create author table
20090804225328 2009-08-04 22:54:33 create blog table
20090804225333 2009-08-04 22:54:33 create post table

You can also get this information from the changelog table by querying it directly in the database. Of course, you won’t see any "pending" items, as those are only known to the migration repository until they're applied to the database.