-
-
Notifications
You must be signed in to change notification settings - Fork 403
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
Divide by zero error when migrating database schema on upgrade install initial setup #650
Comments
@tinutac can you have a look at this? |
@DoctorOctagonapus can you provide the column data of the database record with id 841? It's inside the table 'Part` |
@FELICITUS I'll take a look this weekend. Quite busy at work :(. I have to update to 0.82 myself. |
@FELICITUS @tinutac My parts table only goes up to id=375. Querying for 841 just returns empty set. I thought the 841 was a line reference in Part.php, am I wrong in thinking that? |
@DoctorOctagonapus you're right, I didn't pay enough attention yesterday ;) Would it be possible that you send us the dump of your Part table? |
@FELICITUS Sure thing here you go. |
@DoctorOctagonapus On second thought, a complete dump for sake of easiness to reproduce would probably be better. For confidentially reasons you can also send the dump to info at partkeepr dot com. |
@FELICITUS I've e-mailed it over to you. |
@tinutac the issue occurs when the sum of additions and removals for a single Part equals 0 and the last entry was an addition. In the dump sent by @DoctorOctagonapus the additions and removals looked like the attachment. |
@FELICITUS Thanks for the update. That shouldn't have been an issue. I'm checking it now. So those are all the entries for that part? Normally the total stock is checked before the division. |
Oh, crap. You're right. I'll make a fix.The $sum is indeed not checked before the division on line 852. |
Oh that occasion, can you take care of the indentation? PartKeepr uses PSR1/2, you can fix it using php-cs-fixer |
I thought it was fixed. Something wrong with Eclipse. I'll check that also. |
…de install initial setup partkeepr#650
[Bugfix] Divide by zero error when migrating database schema on upgrade install initial setup #650
I will test the patch tomorrow and report back |
@FELICITUS I hope the formatting is ok now. I've tested it on my test database here and it seems ok. I've tried to imagine all possible scenarios. Hope none missed this time. |
I just tested the patch and it works fine with the dump from @DoctorOctagonapus. I will close the issue now, a new release should be out today or tomorrow. |
I'm upgrading PartKeepr from v0.1.9 to v0.82 on Ubuntu 14.04.4, I've been using this as my basic guide: https://wiki.partkeepr.org/wiki/PartKeepr_on_Debian_%22Jessie%22 and have made it as far as running the initial setup, step "Setup (1/2)". Testing for database connectivity and setting up the database schema run successfully, but migrating the database schema returns the error "Invalid response from server". I'm pasting the error details below:
Invalid Response from server
Warning: Division by zero
500 Internal Server Error - ContextErrorException
Stack Trace
in src/PartKeepr/PartBundle/Entity/Part.php at line 841
in src/PartKeepr/CoreBundle/DoctrineMigrations/Version20151002183125.php at line 26 +
in vendor/doctrine/migrations/lib/Doctrine/DBAL/Migrations/Version.php at line 290 +
in vendor/doctrine/migrations/lib/Doctrine/DBAL/Migrations/Migration.php at line 176 +
in src/PartKeepr/SetupBundle/Controller/SchemaMigrationSetupController.php at line 34 +
in app/bootstrap.php.cache at line 3192 +
in app/bootstrap.php.cache at line 3154 +
in app/bootstrap.php.cache at line 3305 +
in app/bootstrap.php.cache at line 2498 +
in src/PartKeepr/SetupBundle/Controller/SetupBaseController.php at line 38 +
in src/PartKeepr/SetupBundle/Controller/SchemaMigrationSetupController.php at line 54 +
in app/bootstrap.php.cache at line 3192 +
in app/bootstrap.php.cache at line 3154 +
in app/bootstrap.php.cache at line 3305 +
in app/bootstrap.php.cache at line 2498 +
in web/setup.php at line 13 +
Logs -
Stack Trace (Plain Text) +
By the look of it there's something in the old database that it's failing on, even though it's the same data that v0.1.9 was happy with. Any ideas on how to fix this?
The text was updated successfully, but these errors were encountered: