【发布时间】:2014-06-03 15:37:23
【问题描述】:
我创建了一个迁移脚本,它创建了一个名为 Archives 的表。
它有 4 列,不包括时间戳/增量。 表格列是名称、标题、内容和图像。
我需要删除不再需要的图像列。
我无法通过搜索找到执行此操作的方法,希望有人能给我最好的方法。
我试图通过创建一个新的迁移然后运行来实现这一点
php artisan migrate:rollback --pretend
但这会尝试回滚之前的迁移。
class DropImageColumnArchive extends Migration
{
/**
* Run the migrations.
* @return void
*/
public function up()
{
Schema::table('archives', function ($table) {
$table->text('image');
});
}
/**
* Reverse the migrations.
* @return void
*/
public function down()
{
Schema::table('archives', function ($table) {
$table->drop_column('image');
});
}
}
【问题讨论】: