对于一个非常旧的迁移(过去运行正常),我收到一个新的迁移错误。
我得到的错误是:SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CHARACTER SET utf8 NOT NULL COLLATE `utf8_unicode_ci`' at line 1 (SQL: ALTER TABLE rooms CHANGE conversion conversion TINYINT(1) CHARACTER SET utf8 NOT NULL COLLATE `utf8_unicode_ci`)
迁移文件如下所示:
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class ChangeRoomsConversionToBoolean extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('rooms', function (Blueprint $table) {
$table->boolean('conversion')->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('rooms', function (Blueprint $table) {
$table->string('conversion')->change();
});
}
}
如果我直接在数据库中运行查询,则会出现错误:ALTER TABLE rooms CHANGE conversion conversion TINYINT(1) CHARACTER SET utf8 NOT NULL COLLATE `utf8_unicode_ci`You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CHARACTER SET utf8 NOT NULL' at line 1
我与Laravel 5.6一起在Homestead上运行。
任何帮助将不胜感激。
宝慕林4294392