最新消息: 新版网站上线了!!!

yii2 备份数据库之migrate的使用方法

cd /var/www/example.com
 
 
./yii migrate/create create_posts_table
确人后自动成功
 
Yii Migration Tool (based on Yii v2.0.0)
 
Create new migration '/var/www/example.com/migrations/m141119_114516_create_posts_table.php'? (yes|no) [no]:yes
New migration created successfully.
A new migration file will be created in the /migrations directory.
 
打开文件后就是这样
 
use yii\db\Schema;
use yii\db\Migration;
 
class m141119_114516_create_posts_table extends Migration
{
    public function up()
    {
    }
 
    public function down()
    {
        echo "m141119_114516_create_posts_table cannot be reverted.\n";
 
        return false;
    }
}

转载请注明:谷谷点程序 » yii2 备份数据库之migrate的使用方法