直到现在我运行php artisan migrate时才发生这个错误
我正在使用MySQL 5.6.34
我尝试了所有我能想到的东西):并且仍然没有运气我有一个类似的表,并且工作得很好,但由于某种原因,这曾经不起作用
public function up()
{
Schema::create('rmaRequests', function (Blueprint $table) {
$table->increments('id');
$table->integer('user_id')->unsigned();
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$table->string('reference_number')->unique();
$table->string('first_name');
$table->string('last_name');
$table->string('email');
$table->string('phone');
$table->string('fax');
$table->string('company');
$table->integer('marketplaceId')->unsigned();
$table->string('order_number')->unsigned();
$table->string('address_1');
$table->string('address_2');
$table->string('city');
$table->string('state');
$table->string('zip');
$table->integer('returnTypeId')->unsigned();
$table->string('sku');
$table->string('qty');
$table->string('productName');
$table->text('comments');
$table->integer('status_id')->unsigned();
$table->string('replacement_tracking');
$table->string('return_tracking');
$table->string('rma_number');
$table->string('refund_number');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('rmaRequests');
}
这是我的迁移文件
<ul>
<li name="one">1</li>
<li name="two">2</li>
<li name="three">3</li>
<li name="four">4</li>
<li name="five">5</li>
<li name="six">6</li>
</ul>
答案 0 :(得分:12)
我认为是因为您将unsigned
用于varchar
?
下面:
$table->string('order_number')->unsigned();
Laravel描述中的unsigned()
方法:
将
integer
列设置为UNSIGNED
了解更多信息:https://laravel.com/docs/5.4/migrations#column-modifiers