Search
 
SCRIPT & CODE EXAMPLE
 

PHP

errno: 150 foreign key constraint is incorrectly formed laravel 8

Since increments() creates an unsigned integer column, you need to define the foreign key column as unsigned integer too.

Default migrations in Laravel 6+ use bigIncrements(), so you need to use unsignedBigInteger() method:

$table->unsignedBigInteger('order_id');
https://laravel.com/docs/6.x/migrations#foreign-key-constraints

For default migrations in older versions of Laravel use unsignedInteger() method:

$table->unsignedInteger('order_id');
Or:

$table->integer('order_id')->unsigned();
Comment

PREVIOUS NEXT
Code Example
Php :: how to remove additional sidebar in magento 2 using xml 
Php :: is alphanumeric php 
Php :: php str_pad not working 
Php :: remove all spaces php 
Php :: php base64 encoded image to png 
Php :: php is day light saving time 
Php :: laravel check if session variable exists 
Php :: php.validate.executablepath wamp 
Php :: remove double space php 
Php :: how to get all roles in wordpress 
Php :: convert post name to id 
Php :: laravel vue csrf 
Php :: current loggedin user laravel 
Php :: laravel collection each 
Php :: laravel php 8 ububtu 
Php :: php ucwords 
Php :: redirect from controller in laravel 
Php :: php chunk array 
Php :: adding column to array php 
Php :: How to fix undefined index: name in PackageManifest.php line 131 error with Composer 
Php :: php timestamp format 
Php :: Creating a Basic Route in Laravel 8 
Php :: laravel queue work on shared hosting 
Php :: how to delete all data from table in php 
Php :: convert string to lowercase in php 
Php :: php curl 
Php :: get today datetime in php 
Php :: laravel hasfile 
Php :: General error: 1709 Index column size too large. The maximum column size is 767 bytes. 
Php :: php clean all output buffers 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =