Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strange error is coming on migration #43

Open
flik opened this issue Apr 25, 2019 · 3 comments

Comments

Projects
None yet
2 participants
@flik
Copy link

commented Apr 25, 2019

I have tried all steps successfully at the end Now getting this exception may you can help...

 php artisan migrate
Migrating: 2019_04_25_113006_create_beautiful_tags_table
Migrated:  2019_04_25_113006_create_beautiful_tags_table
Migrating: 2019_04_25_113006_create_nice_posts_table

   Illuminate\Database\QueryException  : SQLSTATE[HY000]: General error: 1005 Can't create table `advert`.`#sql-155c_4` (errno: 150 "Foreign key constraint is incorrectly formed") (SQL: alter
table `nice_posts` add constraint `nice_posts_brilliant_category_id_foreign` foreign key (`brilliant_category_id`) references `brilliant_categories` (`id`))

  at D:\xampp\htdocs\advert\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 `advert`.`#sql-155c_4` (errno: 150 "Foreign key constraint is incorrectly formed")")
      D:\xampp\htdocs\advert\vendor\laravel\framework\src\Illuminate\Database\Connection.php:458

  2   PDOStatement::execute()
      D:\xampp\htdocs\advert\vendor\laravel\framework\src\Illuminate\Database\Connection.php:458

  Please use the argument -v to see more details.
@dog-ears

This comment has been minimized.

Copy link
Owner

commented Apr 26, 2019

Thank you for your reporting errors.
I will check this error.

If you can, tell me your development environment as detailed as possible.
And give me your crud-d-scaffold.json file.

@flik

This comment has been minimized.

Copy link
Author

commented Apr 29, 2019

{ "app_type": "web", "use_laravel_auth": false, "models": [ { "id": 1, "name": "nicePost", "display_name": "NICE POST", "use_soft_delete": true, "schemas": [ { "id": 1, "name": "bigTitle", "display_name": "BIG TITLE", "type": "string", "input_type": "text", "varidate": "", "faker_type": "name()", "nullable": false, "unique": false, "show_in_list": true, "show_in_detail": true, "belongsto": "", "parent_id": 1 }, { "id": 2, "name": "shallowBody", "display_name": "SHALLOW BODY", "type": "string", "input_type": "textarea", "varidate": "", "faker_type": "paragraph()", "nullable": false, "unique": false, "show_in_list": false, "show_in_detail": true, "belongsto": "", "parent_id": 1 }, { "id": 3, "name": "brilliantCategory_id", "display_name": "brilliantCategory - NAME", "type": "integer", "input_type": "select", "varidate": "", "faker_type": "numberBetween(1,30)", "nullable": true, "unique": false, "show_in_list": true, "show_in_detail": true, "belongsto": "brilliantCategory", "parent_id": 1 } ], "is_pivot": false, "schema_id_for_relation": 1, "pos_x": 707, "pos_y": 347, "_next_schema_id": 4 }, { "id": 2, "name": "beautifulTag", "display_name": "TAG", "use_soft_delete": true, "schemas": [ { "id": 1, "name": "tagName", "display_name": "TAG NAME", "type": "string", "input_type": "text", "varidate": "", "faker_type": "name()", "nullable": false, "unique": false, "show_in_list": true, "show_in_detail": true, "belongsto": "", "parent_id": 2 } ], "is_pivot": false, "schema_id_for_relation": 1, "pos_x": 1357, "pos_y": 158, "_next_schema_id": 2 }, { "id": 3, "name": "brilliantCategory", "display_name": "CATEGORY", "use_soft_delete": true, "schemas": [ { "id": 1, "name": "categoryName", "display_name": "CATEGORY NAME", "type": "string", "input_type": "text", "varidate": "", "faker_type": "name()", "nullable": false, "unique": false, "show_in_list": true, "show_in_detail": true, "belongsto": "", "parent_id": 3 } ], "is_pivot": false, "schema_id_for_relation": 1, "pos_x": 486, "pos_y": 76, "_next_schema_id": 2 }, { "id": 4, "name": "goodComment", "display_name": "GOOD COMMENT", "use_soft_delete": true, "schemas": [ { "id": 1, "name": "superTitle", "display_name": "SUPER TITLE", "type": "string", "input_type": "text", "varidate": "", "faker_type": "name()", "nullable": false, "unique": false, "show_in_list": true, "show_in_detail": true, "belongsto": "", "parent_id": 4 }, { "id": 2, "name": "eligibleBody", "display_name": "ELIGIBLE BODY", "type": "string", "input_type": "textarea", "varidate": "", "faker_type": "paragraph()", "nullable": false, "unique": false, "show_in_list": false, "show_in_detail": true, "belongsto": "", "parent_id": 4 }, { "id": 3, "name": "nicePost_id", "display_name": "nicePost - NAME", "type": "integer", "input_type": "select", "varidate": "", "faker_type": "numberBetween(1,30)", "nullable": true, "unique": false, "show_in_list": true, "show_in_detail": true, "belongsto": "nicePost", "parent_id": 4 } ], "is_pivot": false, "schema_id_for_relation": 1, "pos_x": 1014, "pos_y": 633, "_next_schema_id": 4 }, { "id": 5, "name": "beautifulTag_nicePost", "display_name": "PIVOT", "use_soft_delete": true, "schemas": [ { "id": 1, "name": "beautifulTag_id", "display_name": "beautifulTag - NAME", "type": "integer", "input_type": "select", "varidate": "", "faker_type": "numberBetween(1,30)", "nullable": true, "unique": false, "show_in_list": true, "show_in_detail": true, "belongsto": "beautifulTag", "parent_id": 5 }, { "id": 2, "name": "nicePost_id", "display_name": "nicePost - NAME", "type": "integer", "input_type": "select", "varidate": "", "faker_type": "numberBetween(1,30)", "nullable": true, "unique": false, "show_in_list": true, "show_in_detail": true, "belongsto": "nicePost", "parent_id": 5 }, { "id": 3, "name": "priority", "display_name": "PRIORITY", "type": "integer", "input_type": "text", "varidate": "", "faker_type": "numberBetween(1,10)", "nullable": true, "unique": false, "show_in_list": true, "show_in_detail": true, "belongsto": "", "parent_id": 5 }, { "id": 4, "name": "note", "display_name": "NOTE", "type": "string", "input_type": "text", "varidate": "", "faker_type": "name()", "nullable": true, "unique": false, "show_in_list": true, "show_in_detail": true, "belongsto": "", "parent_id": 5 } ], "is_pivot": true, "schema_id_for_relation": 0, "pos_x": 1030, "pos_y": 147, "_next_schema_id": 5 } ], "tool": "ER-DIAGRAM-TOOL", "_next_model_id": 6 }

@flik

This comment has been minimized.

Copy link
Author

commented Apr 29, 2019

.env

`APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:ee1y2CIdmhyaoj0SSvYgrpQJRm/UfZGSlPfROUDKkuM=
APP_DEBUG=true
APP_URL=http://localhost

LOG_CHANNEL=stack

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=xxxx
DB_USERNAME=xxxx
DB_PASSWORD=xxxx

BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.