PLATFORM
  • Tails

    Create websites with TailwindCSS

  • Blocks

    Design blocks for your website

  • Wave

    Start building the next great SAAS

  • Pines

    Alpine & Tailwind UI Library

  • Auth

    Plug'n Play Authentication for Laravel

  • Designer comingsoon

    Create website designs with AI

  • DevBlog comingsoon

    Blog platform for developers

  • Static

    Build a simple static website

  • SaaS Adventure

    21-day program to build a SAAS

Question By
Unsolved

Migrating: 2016_07_29_171128_create_foreign_keys NOT succesful

newwzsddd

Jul 20th, 2019 06:43 PM

Migration of chatter stops at, while other tables migrated well.

Migrating: 2016_07_29_171128_create_foreign_keys

Illuminate\Database\QueryException : SQLSTATE[HY000]: General error: 1005 Can't create table uxxxxeu_livranochatter.chatter_discussion (errno: 150 "Foreign key constraint is incorrectly formed") (SQL: alter table chatter_discussion add constraint chatter_discussion_user_id_foreign foreign key (user_id) references users (id) on delete cascade on update cascade)

at /home/uxxxxeu/domains/xxxx.eu/public_html/livranochatter/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664

bobbyiliev

Jul 22nd, 2019 04:07 AM

Hi,

I guess that you've might have forgotten to define a primary key for the users table. Make sure that you have that and this migration should work as normal.

Hope that this helps! Bobby

cookie

Jul 30th, 2019 05:04 AM

Hi, here the original Text from the Laravel Documentation:

Migrations & bigIncrements

Likelihood Of Impact: None

As of Laravel 5.8, migration stubs use the bigIncrements method on ID columns by default. Previously, ID columns were created using the increments method.

This will not affect any existing code in your project; however, be aware that foreign key columns must be of the same type. Therefore, a column created using the increments method can not reference a column created using the bigIncrements method

anand-gupta

Jan 8th, 2020 05:55 AM

Hi , I am install laravel 5.8 and create auth than install chatter in laravel project. Same problm face in my project.

but My same problem is sortout

than changes some file from migration folder. you find user_id and change $table->integer('user_id')->unsigned(); replace this code to $table->unsignedBigInteger('user_id');

and change user,password_reset and slug_field table in which email length 100 like this $table->string('email',100)->unique(); than run command php artisan migrate