【发布时间】:2018-01-30 20:42:50
【问题描述】:
我需要从我的数据库表clients 中删除列UserDomainName。
起初我通过执行composer require doctrine/dbal 后跟composer update 安装doctrine/dbal,如documentation 中所述。
然后我创建了我想用来删除列的迁移:
php artisan make:migration remove_user_domain_name_from_clients --table=clients
我在down() 方法中添加了Schema::dropColumn('UserDomainName');:
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class RemoveDomainName extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('clients', function (Blueprint $table) {
//
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('clients', function (Blueprint $table) {
Schema::dropColumn('UserDomainName');
});
}
}
但是,我明白了
Migrating: 2017_08_22_135145_remove_user_domain_name_from_clients
Migrated: 2017_08_22_135145_remove_user_domain_name_from_clients
在执行php artisan migrate 之后没有删除任何列。
如果我再次执行它,我会得到Nothing to migrate.
【问题讨论】:
标签: php laravel symfony doctrine-orm