-
-
Notifications
You must be signed in to change notification settings - Fork 389
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
Cast to integer to avoid Spanner GCP incompatibility #1060
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good from my side,
and i would go for this because the intent is declared below on the Types::INTEGER
at tline https://github.com/doctrine/migrations/pull/1060/files#diff-fd5b2ea887e9abe3b606201b76d10bb9R144
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
To me looks good and reasonable. Is there a way to add a test for such change? |
@goetas Seems this test was already done before, but with SQLite driver it always passed :) |
@greg0ire do you have suggestions here? (merge it as it is?) |
If an execution time appears that is bigger than I recommend to add a unit test because this change has to be handled to prevent breaks in the future in case this would be a major problem for users. BTW: Should this PR target |
this is indeed a bugfix |
I will check better way to test this and come back soon. Thanks all for the input. |
Tests added @goetas @SenseException @stof Can you please take a look and merge if is ok. Thank you in advance |
tests/Doctrine/Migrations/Tests/Metadata/Storage/TableMetadataStorageTest.php
Outdated
Show resolved
Hide resolved
Please associate your email address with your Github account, or change the Also, please kindly squash your commits together. If you don't, we'll try to remember to do it for you but it's best if you save us this trouble. How to do that?
And finally, since this is a bugfix, I think you should target 3.0.x |
Let me help you with the commits :P |
I am currently receiving error from GCP when trying to persist data using Spanner: ``` An exception occurred while executing 'INSERT INTO doctrine_migration_versions (version, executed_at, execution_time) VALUES (?, ?, ?)' with params ["oat\\generis\\migrations\\Version202009301828472348_generis", "2020-10-02T11:54:13.671062Z", 130]: { "message": "Invalid value for bind parameter param3: Expected INT64.", "code": 3, "status": "INVALID_ARGUMENT", "details": [ { "@type": "grpc-server-stats-bin", "data": "<Unknown Binary Data>" } ] } ``` Cause the 130 is actually `130.0` (a float). Since migrations always expects an integer here I would like to cast this value to avoid driver incompatibilities
I appreciate, thanks! :) |
In my experience mocks have been always a problem. The less the better. I've created #1063 that solves the same problem just with a different testing strategy. Can you please review that version ? (@greg0ire @gabrielfs7 ) |
@goetas I have dropped a comment there: https://github.com/doctrine/migrations/pull/1063/files#r507585488 Unfortunately the test still passes if you remove the cast. The way I did the test breaks if the cast is removed. |
Thanks @gabrielfs7 ! |
Summary
execution_time
and fix GCP Spanner issueI am currently receiving error from GCP when trying to persist data using Spanner:
Cause the 130 is actually
130.0
(a float).Since migrations always expects an integer here I would like to cast this value to avoid driver incompatibilities
The issue was reported here: #1061