I have a simple laravel migration with a foreign key.
public function up()
{
Schema::create('smp_posts', function (Blueprint $table) {
$table->increments('id');
$table->integer('project_id')->unsigned();
// Some other stuff
$table->foreign('project_id')->references('id')->on('smp_projects')->onDelete('cascade');
});
}
When I run the migrate command php artisan migrate:refresh. I get this error:
Illuminate\Database\QueryException:
SQLSTATE[2BP01]: Dependent objects still exist: 7
ERROR: cannot drop table smp_projects because other objects depend on it DETAIL: constraint smp_posts_project_id_foreign on table smp_posts depends on table smp_projects
Normally all childs should be deleted, because I set the onDelete() to cascade. Right? What's going wrong?