brtiver blog

mainly about tips of web application tech in English from Japan.

Simple Database Migration Tool, Dbup

Dbup is a very simple migration tool with UP command

I published a new database migration tool for PHP, Dbup.

github: https://github.com/brtriver/dbup

f:id:brtRiver:20130502021745p:plain

 

How simple?

  • You have only to download dbup.phar.
  • Dbup has only up command. Dbup does not have down command.
  • Dbup use just a plain old sql, so you don't have to learn ORM nor DSL. You write sql file and just call up command.
  • Dbup use just PDO class to migrate.
  • Dbup doesn't need the table of the migration status in a database to migrate.

 Show status

f:id:brtRiver:20130502022424p:plain

 

 Why only up command?

If in a production env, after you added a new column and users insert new data in it, you cannot down migration safely. because new data may be lost.

If you use Dbup and want to do down a database schema, then you have only to create new sql file to execute as a new up sql file.