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

Incorrect Table Name '' #122

Closed
jcrann opened this issue May 27, 2020 · 7 comments
Closed

Incorrect Table Name '' #122

jcrann opened this issue May 27, 2020 · 7 comments

Comments

@jcrann
Copy link

jcrann commented May 27, 2020

`Migrating: 2016_01_15_114412_create_role_user_table

Illuminate\Database\QueryException

SQLSTATE[42000]: Syntax error or access violation: 1103 Incorrect table name '' (SQL: alter table roleUserTable add constraint roleusertable_role_id_foreign foreign key (role_id) references `` (id) on delete cascade)

at C:\xampp\htdocs\laravel\vendor\laravel\framework\src\Illuminate\Database\Connection.php:671
667| // If an exception occurs when attempting to run a query, we'll format the error
668| // message to include the bindings with SQL, which will make this exception a
669| // lot more helpful to the developer instead of just the database's errors.
670| catch (Exception $e) {

671| throw new QueryException(
672| $query, $this->prepareBindings($bindings), $e
673| );
674| }
675|

1 C:\xampp\htdocs\laravel\vendor\laravel\framework\src\Illuminate\Database\Connection.php:464
PDOException::("SQLSTATE[42000]: Syntax error or access violation: 1103 Incorrect table name ''")

2 C:\xampp\htdocs\laravel\vendor\laravel\framework\src\Illuminate\Database\Connection.php:464
PDOStatement::execute()`

@jcrann
Copy link
Author

jcrann commented May 27, 2020

Laravel 7

@jeremykenedy
Copy link
Owner

You have something misconfigured. The error is in your post above and is application specific.

@bmcclure
Copy link

This isn't documented in the setup instructions (I don't think), but I was getting this error until I ran php artisan config:clear

@jeremykenedy
Copy link
Owner

jeremykenedy commented Sep 11, 2020

That’s your app. Not the package.

That command is to clear your apps cached config and env file.

@bmcclure
Copy link

bmcclure commented Sep 11, 2020

Yes, you are correct. However your package installs config into the app per your package's instructions, and then the next instruction is to run the migration. If you simply follow those instructions without clearing the config cache in-between, then in my testing so far, this error always occurs.

I'm not saying it's your fault or a problem with your package, I'm just indicating that it might be the fix the OP here needs.

@jeremykenedy
Copy link
Owner

You choose to use caching which makes it an issue with your app.

@bmcclure
Copy link

bmcclure commented Sep 11, 2020

Yes, my app that I chose to use the core caching features of, and everyone else's app who uses the core caching features, would need to take this step into account while going through your instructions.

I'm not sure what you're getting at with your responses. I was trying to provide assistance to the op since it didn't seem like his issue was resolved, so I shared what worked for me and what has been a required step for me when I use this package.

It is your choice whether to call that out in the documentation, I certainly didn't request you to, but I'm calling it out here because it seems relevant to the OP's issue.

Whoever's issue it is, the more people who can successfully use your package without error, the better, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants