我正在尝试在数据库中添加一列,但是在创建类时:
我的班级名称是add_meta_to_cities_table.php
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddMetaToCitiesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('cities', function (Blueprint $table) {
$table->text('meta_desc');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
}
就像我以前跑过的一样composer dump-autoload
。
当我尝试运行时,我会遇到php artisan migrate
此错误吗?
[Symfony \ Component \ Debug \ Exception \ FatalThrowableError]
致命错误:找不到类“表”
这可能从哪里来?
迁移文件名的通常格式如下:
YYYY_MM_DD_000000_create_some_table.php
也许可以这样尝试,或者完全删除迁移,然后通过手工艺者对其进行更新。当您通过工匠进行更新时,应以这种格式自动生成它:
php artisan make:migration create_some_table
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句