SQLSTATE [42000]:语法错误或访问冲突:1072表中不存在键列'proform_id'

问题描述

在php artisan迁移之后:我收到错误消息:

SQLSTATE [42000]:语法错误或访问冲突:1072表中不存在键列'proform_id'(SQL:alter table proforms添加约束proforms_proform_id_foreign外键({{1} })在删除级联上引用proform_idproforms

这是迁移,会产生错误: 2020_08_08_093303_create_dynamic_field.php

id

这是与之相关的迁移: 2020_07_29_101958_proforms.php

<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateDynamicField extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('dynamic_fields',function (Blueprint $table) {
            $table->increments('id');
            $table->string('id_pozycji')->nullable();
            $table->string('name')->nullable();
            $table->string('PKWIU')->nullable();
            $table->integer('quantity')->nullable();
            $table->integer('unit')->nullable();
            $table->integer('netunit')->nullable();
            $table->integer('nettotal')->nullable();
            $table->integer('VATrate')->nullable();
            $table->integer('grossunit')->nullable();
            $table->integer('grosstotal')->nullable();
            $table->integer('proform_id')->nullable();
            $table->timestamps();
            $table->time('deleted_at')->nullable();
        });

        Schema::table('proforms',function (Blueprint $table){
            $table->foreign('proform_id')
                  ->references('id')
                  ->on('proforms')
                  ->onDelete('cascade');            
        });





    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('dynamic_fields');
    }
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)