8
यहाँ मेरी माइग्रेशन कोड है:Laravel 4 प्रवासन - विदेशी कुंजी बाधा नहीं जोड़ा जा सकता
public function up()
{
Schema::create('foos', function(Blueprint $table) {
// Primary key
$table->increments('id');
// Standard
$table->engine = 'InnoDB';
$table->timestamps();
$table->softDeletes();
});
Schema::create('bars', function(Blueprint $table) {
// Primary key
$table->increments('id');
// Define foreign key
$table->integer('foo_id')->unsigned;
// Foreign key contraints
// NOTE: causes "General error: 1215 Cannot add foreign key constraint"
// $table->foreign('foo_id')->references('id')->on('foos');
// Standard
$table->engine = 'InnoDB';
$table->timestamps();
$table->softDeletes();
});
}
public function down()
{
Schema::drop('foos');
Schema::drop('bars');
}
विदेशी कुंजी बाधा परिभाषित करने के लिए कोड बाहर टिप्पणी नहीं की जाती है, तो मैं कमांड लाइन पर निम्नलिखित त्रुटि मिलती है: जनरल त्रुटि: 1215 विदेशी कुंजी बाधा नहीं जोड़ सकता है।
कोई विचार क्या मैं गलत कर रहा हूं?
होमर के प्रसिद्ध शब्दों में। धन्यवाद! – StackOverflowNewbie
अपने आप को मत मारो - मैं केवल आपके प्रश्न का उत्तर दे सकता हूं क्योंकि मैंने वही काम किया था। :-) – ceejayoz