如何使用字符串格式在兩個(gè)表之間建立關(guān)系?我收到錯(cuò)誤SQLSTATE[HY000]: 常規(guī)錯(cuò)誤: 1005 無(wú)法創(chuàng)建表 。(錯(cuò)誤:150“外鍵約束格式不正確”)(SQL:更改表在刪除級(jí)聯(lián)時(shí)添加約束外鍵 () 引用 ())...ordercustomizesordercustomizesordercustomizes_userorder_id_foreignuserorder_iduserordersorder_number Schema::create('ordercustomizes', function (Blueprint $table) { $table->engine = 'InnoDB'; $table->increments('id'); $table->string('userorder_id'); $table->integer('product_id')->unsigned(); $table->integer('customizetitle_id')->unsigned(); $table->integer('customizeproduct_id')->unsigned(); $table->timestamps(); $table->foreign('userorder_id') ->references('order_number') ->on('userorders') ->onDelete('cascade');主表: Schema::create('userorders', function (Blueprint $table) { $table->engine = 'InnoDB'; $table->increments('id'); $table->integer('product_id')->unsigned(); $table->integer('storeinfo_id')->unsigned(); $table->integer('user_id')->unsigned(); $table->string('order_number');
laravel, 遷移參考表字符串格式在刪除級(jí)聯(lián)
炎炎設(shè)計(jì)
2022-08-19 09:53:41