MySQL
migration

DBマイグレーションツールまとめメモ

More than 1 year has passed since last update.

rails(ActiveRecord)

20161019235959_create_users.rb
class CreateUsers < ActiveRecord::Migration
  def change
    create_table :users do |t|
      t.string :name
    end
  end
end

flyway

Phinx

20161019235959_create_users.php
<?php
use Phinx\Migration\AbstractMigration;

class CreateUsersTable extends AbstractMigration
{
    // Migrate Up
    public function up()
    {
        $table = $this->table('users');
        $table->addColumn('id', 'integer')
              ->addColumn('name', 'string')
              ->create();
    }

    // Migrate Down
    public function down()
    {
        $this->execute('DELETE FROM users');
    }
}

migr8

Phpmig

Yii

simple-db-migrate

ridgepole

goose

migo

Liquibase

MyBatis Migrations