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

Database driver will fail to create records in strict db configruations. #65

Closed
nCrazed opened this issue Jan 15, 2017 · 5 comments
Closed

Comments

@nCrazed
Copy link
Contributor

nCrazed commented Jan 15, 2017

Running php artisan currency:manage add USD will result in an INSERT query that attempts to insert an empty string ('') value into the integer id column which yields the following error on PostgreSQL:

invalid input syntax for integer

and probably something similar on MySQL with relevant strict modes enabled.

This is due to this default array. Since your migration sets the id column to auto increment the id should be dropped from the default array completely.

@lpeterke
Copy link

+1

@l3xq
Copy link

l3xq commented Jan 17, 2017

Even with the suggested fix by nCrazed, I still have same error:

[PDOException]
  SQLSTATE[22P02]: Invalid text representation: 7 ERROR:  invalid input syntax for integer: ""

@nCrazed
Copy link
Contributor Author

nCrazed commented Jan 17, 2017

@l3xq can paste the full error with the query that triggers it?

@l3xq
Copy link

l3xq commented Jan 18, 2017

@nCrazed Sorry it took so long to reply.
Per your instructions removed 'id', and the error persists.

@nCrazed
Copy link
Contributor Author

nCrazed commented Jan 19, 2017

@l3xq I see that the id is still present in the query which it shouldn't be. Can you post the full stack trace to make sure that the insert is not being called from somewhere else?

As far as I can tell this is the only source of INSERT queries in the context of the currency:manage add command and the id is set only in that array. Without the id key in the array it should not be present in the query, but it's hard for me to test and confirm this assertion because the package expects to be within the context of a full Laravel application so it's impossible to test in isolation. Which is probably why there are no tests.

@Torann any plans on making the package testable without the entire laravel framework?

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