samedi 3 janvier 2015

Error when run the migration command


Vote count:

0




When run migrate command the following error is displaying



[Illuminate\Database\QueryException]
SQLSTATE[HY000]: General error: 1005 Can't create table 'SSA_DATA.#sql-431_1b8' (errno: 150) (SQL: alter table `reports_fields` add constraint rep
orts_fields_report_id_foreign foreign key (`report_id`) references `reports_list` (`id`))



migration code is below




public function up()
{
Schema::create('reports_fields', function(Blueprint $table)
{
$table->increments('id');
$table->smallInteger('report_id')->unsigned();
$table->smallInteger('field_id')->unsigned();
});

Schema::table('reports_fields', function($table)
{
$table->foreign('report_id')->references('id')->on('reports_list');
});
}

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


What is the reason for this ?



asked 1 min ago







Error when run the migration command

Aucun commentaire:

Enregistrer un commentaire