I have this error:
PDOException::("SQLSTATE[HY000]: General error: 1005 Can't create table
shreemad
.posts
(errno: 150 "Foreign key constraint is incorrectly formed")")
Table 1:
public function up()
{
Schema::create('category', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedInteger('type_id');
$table->string('product_type');
$table->timestamps();
});
}
Table:
public function up()
{
Schema::create('posts', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedInteger('type');
$table->foreign('type')->references('type_id')->on('category');
$table->string('title');
$table->string('description');
$table->integer('price')->nullable();
$table->mediumtext('image')->nullable();
$table->timestamps();
});
}