私はこれを理解しようとして頭を悩ませていますが、役に立ちません。助けてください。
次のコードがあります。
Schema::create('inventory_category_relations', function(Blueprint $table)
{
$table->increments('id');
$table->integer('inventory_category_id')->unsigned()->nullable()->default(null);
$table->foreign('inventory_category_id')->references('id')->on('inventory_categories');
$table->integer('inventory_id')->unsigned()->nullable()->default(null);
$table->foreign('inventory_id')->references('id')->on('inventory');
$table->timestamps();
$table->softDeletes();
});
上記のコードは、'inventory' および 'inventory_categories' テーブルを参照しています。これらのテーブルは既に作成されており、完全に機能する他のテーブルによって参照されています。ただし、上記のコードで「php artisan migrate」を実行しようとするたびに、端末が爆発します。
編集 ここに私の元の「在庫」と「在庫_カテゴリ」作成ステートメントがあります:
Schema::create('inventory_categories', function(Blueprint $table)
{
$table->increments('id');
$table->string('name');
$table->timestamps();
$table->softDeletes();
});
Schema::create('inventory', function(Blueprint $table)
{
$table->increments('id');
$table->string('title');
$table->mediumText('basic_description');
$table->unsignedInteger('inventory_type_id');
$table->foreign('inventory_type_id')->references('id')->on('inventory_types')->onDelete('cascade');
$table->unsignedInteger('vendor_id');
$table->foreign('vendor_id')->references('id')->on('vendors')->onDelete('cascade');
$table->unsignedInteger('inventory_category_id');
$table->foreign('inventory_category_id')->references('id')->on('inventory_categories')->onDelete('cascade');
$table->decimal('price',10,2);
$table->decimal('compare_price',10,2);
$table->integer('quantity');
$table->string('sku');
$table->string('barcode');
$table->boolean('no_stock_purchase')->default(0);
$table->boolean('shipping_address')->default(0);
$table->decimal('shipping_weight')->default(0);
$table->boolean('free_shipping')->default(0);
$table->boolean('taxes')->default(1);
$table->boolean('multiple_options')->default(0);
$table->boolean('custom_variants')->default(0);
$table->boolean('active')->default(1);
$table->boolean('has_publish_date')->default(0);
$table->dateTime('start_date');
$table->dateTime('end_date');
$table->string('url');
$table->string('meta_title');
$table->mediumText('meta_description');
$table->boolean('has_commission')->default(0);
$table->unsignedInteger('created_by');
$table->foreign('created_by')->references('id')->on('users')->onDelete('cascade');
$table->timestamps();
$table->softDeletes();
});
ワンプサーバーでlaravel 4.2を使用しています
更新: [php artisan migrate > migrate_error.log] を使用し、結果を Pastebin に投稿しました。ファイルが大きすぎましたが、収まるものを投稿しました: http://pastebin.com/J8KZn7R5