[英]Laravel Migration Failed After The First File/Run(except file for creating users and password_reset table)
I tried making database using Laravel Migration, it works only in first file and run... after that, I don't know what it caused to fail.我尝试使用 Laravel 迁移制作数据库,它仅适用于第一个文件并运行...之后,我不知道它导致失败的原因。 I made date, head, and many more for the database, date successfully implemented but head fail even after I remove date migration file and using limiter on interger didn't give any effect.我为数据库制作了日期、头部和更多内容,日期成功实现,但头部失败,即使我删除了日期迁移文件并且在整数上使用限制器也没有产生任何效果。 Error Screenshot错误截图
.env .env
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=mono
DB_USERNAME=root
DB_PASSWORD=
Localhost本地主机
create_head_table.php create_head_table.php
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateHeadTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('head', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('head', 50);
$table->interger('tgl', 50);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('head');
}
}
Pay attention to your "create_head_table.php" migration file.注意您的“create_head_table.php”迁移文件。 As of your image the error occurs on line 19 and so why?在您的图像中,错误发生在第 19 行,为什么? In the up
function:在up
中:
public function up()
{
Schema::create('head', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('head', 50);
$table->interger('tgl', 50);//$table->integer('tgl'); or $table->string('tgl', 50);
});
}
Is the last field of table integer
or string
?表的最后一个字段是integer
还是string
? If it is string
so plz correct it but if it is integer
your syntax is wrong.如果它是string
,请纠正它,但如果它是integer
你的语法是错误的。 The second parameter in integer is autoincrement
not length integer 中的第二个参数是autoincrement
而不是长度
You have an spelling mistake in here $table->interger('tgl', 50);
你在这里有拼写错误$table->interger('tgl', 50);
. . It will be integer
not interger
.它将是integer
而不是interger
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.