SQLSTATE[23000]: Integrity constraint violation: 1217 Cannot delete or update a parent row: a foreign key constraint fails (SQL: drop table `users`)
I know this has been answered several times, but still i cant figure our whats wrong with my migration.
First i call the partner migration
public function up()
{
Schema::create('partners', function (Blueprint $table) {
$table->engine = 'InnoDB';
$table->increments('id');
$table->integer('admin_id')->unsigned();
$table->string('company_name', 50);
...
}
public function down()
{
Schema::drop('partners');
}
Then i call the Users migration
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->engine = 'InnoDB';
$table->increments('id');
$table->integer('partner_id')->unsigned();
$table->string('email', 70)->unique();
....
}
public function down()
{
Schema::table('users', function(Blueprint $table) {
$table->dropForeign('users_partner_id_foreign');
});
Schema::drop('users');
}
Can anybody figure out whats wrong with this? i am using laravel 5.3 and php7
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire