I get this error when I do php artisan migrate. Is there something wrong in my migration files?
Illuminate\Database\QueryException : SQLSTATE[HY000]: General error: 1005 Can't create table
test
.blog_posts
(errno: 150 "Foreign key constraint is incorrectly formed") (SQL: alter tableblog_posts
add constraintblog_pos ts_user_id_foreign
foreign key (user_id
) referencesusers
(id
))
blog_posts
$table->increments('id');
$table->integer('cаtegory_id')->unsigned();
$table->integer('user_id')->unsigned();
$table->string('slug')->unique();
$table->string('title');
$table->text('excerpt')->nullable(); դաշտ չի
$table->text('content_raw');
$table->text('content_html');
$table->boolean('is_published')->default(false);
$table->timestamp('published_at')->nullable();
$table->timestamps();
$table->softDeletes();
$table->foreign('user_id')->references('id')->on('users');
$table->foreign('cаtegory_id')->references('id')->on('blog_categories');
$table->index('is_published');
blog_categories
$table->increments('id');
$table->integer('parent_id')->unsigned()->default(0);
$table->string('slug')->unique();
$table->string('title');
$table->text('description')->unllable();
$table->timestamps();
$table->softDeletes();
users
$table->bigIncrements('id');
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();