Created
February 29, 2020 20:39
-
-
Save Ahmed-Radi/8a8e5dc840355855fa61489c4828a37a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Illuminate\Database\QueryException : SQLSTATE[HY000]: General error: 1005 Can't create table `project`.`#sql-3c44_2f` (errno: 150 "Foreign key constraint is incorrectly formed") (SQL: alter table `comments` add constraint `comments_com_post_foreign` foreign key (`com_post`) references `posts` (`post_id`) on delete cascade) | |
at E:\xampp\htdocs\laravel\Laravel\vendor\laravel\framework\src\Illuminate\Database\Connection.php:664 | |
660| // If an exception occurs when attempting to run a query, we'll format the error | |
661| // message to include the bindings with SQL, which will make this exception a | |
662| // lot more helpful to the developer instead of just the database's errors. | |
663| catch (Exception $e) { | |
> 664| throw new QueryException( | |
665| $query, $this->prepareBindings($bindings), $e | |
666| ); | |
667| } | |
668| | |
Exception trace: | |
1 PDOException::("SQLSTATE[HY000]: General error: 1005 Can't create table `project`.`#sql-3c44_2f` (errno: 150 "Foreign key constraint is incorrectly formed")") | |
E:\xampp\htdocs\laravel\Laravel\vendor\laravel\framework\src\Illuminate\Database\Connection.php:458 | |
2 PDOStatement::execute() | |
E:\xampp\htdocs\laravel\Laravel\vendor\laravel\framework\src\Illuminate\Database\Connection.php:458 | |
Please use the argument -v to see more details. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To Solve This problem
Just Add unsigned();
Look to this example
If you Want add foreign key to this
Just Add unsigned()