LoginSignup
31

More than 5 years have passed since last update.

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

Last updated at Posted at 2016-10-19

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

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
31