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

Not null violation error in migrations #3148

Merged

Conversation

fsamapoor
Copy link
Member

@fsamapoor fsamapoor commented Nov 8, 2023

A bug has been introduced with 3da60e4 which is causing migration errors when you try to upgrade the app.

Database error when running migration 050100Date20230515083001 for app polls

An exception occurred while executing a query: SQLSTATE[23502]: Not null violation: 7 ERROR:  column "session_id" contains null values

Having a non-nullable column with the default value of null is definitely not right. likely introduced by mistake with the refactoring of the class.

In this PR, I have made the session_id column nullable which is the intended behavior.

I have also reviewed all other combinations on the file and found no other non-nullable columns with a default value of null.

This is not being reflected with the new installations of the app, as the database handles the error seamlessly. However, as mentioned earlier, an error is thrown when upgrading older versions of the app.

fsamapoor and others added 2 commits November 8, 2023 16:34
The column is supposed to be nullable, and updating the app throws `column "session_id" contains null values` error because it was not nullable.

Signed-off-by: Faraz Samapoor <f.samapoor@gmail.com>
Signed-off-by: Faraz Samapoor <fsa@adlas.at>
Signed-off-by: Faraz Samapoor <f.samapoor@gmail.com>
Signed-off-by: Faraz Samapoor <fsa@adlas.at>
@fsamapoor fsamapoor force-pushed the not_null_violation_error_in_migrations branch from 381be4f to ccf63b8 Compare November 8, 2023 13:04
@dartcafe
Copy link
Collaborator

dartcafe commented Nov 10, 2023

Yes. right, the definition is wrong. But what confused me, is that there was an error triggered. The table gets dropped and recrated with updates. Unfortunately you did not provide an issue with your system setup and the triggered error message

Edit: ok. I can interprate the location of the error. But there should no error message, because the table should have no entiries.

@dartcafe dartcafe self-requested a review November 10, 2023 20:32
@dartcafe dartcafe added the bug label Nov 10, 2023
@dartcafe dartcafe added this to the 5.4.2 milestone Nov 10, 2023
@fsamapoor
Copy link
Member Author

Yes. right, the definition is wrong. But what confused me, is that there was an error triggered. The table gets dropped and recrated with updates. Unfortunately you did not provide an issue with your system setup and the triggered error message

Edit: ok. I can interprate the location of the error. But there should no error message, because the table should have no entiries.

I don't have direct access to the Nextcloud instance our deployment team attempted to upgrade. I know it was a v24 Nextcloud server using Postgres, and the plan was to upgrade it to v26. I'll provide the necessary information in a new issue once I gain access to the server.

@dartcafe
Copy link
Collaborator

Yes. Would be good. Possibly there is a migration path, I did not take into account.

@dartcafe dartcafe merged commit b5b2bcb into nextcloud:master Nov 11, 2023
15 checks passed
Copy link

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

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

Successfully merging this pull request may close these issues.

None yet

2 participants