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

QueryException on soft delete starting in 2.18.3 #781

Closed
ghost opened this issue Aug 11, 2022 · 1 comment · Fixed by #789
Closed

QueryException on soft delete starting in 2.18.3 #781

ghost opened this issue Aug 11, 2022 · 1 comment · Fixed by #789
Labels
bug An existing feature is not working as intended

Comments

@ghost
Copy link

ghost commented Aug 11, 2022

Describe the bug
Starting on version 2.18.3, attempting to soft delete a record produces a QueryException indicating a SQL syntax issue:

masoniteorm.exceptions.QueryException: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE `softdelete_records`.`id` = '1876d130-5c24-47cb-af4e-dff6f77710b3'' at line 1")

I have linked an example project which reproduces the behavior below. The issue seems to begin with some change made as of version 2.18.3. Installing masonite-orm at 2.18.2 no longer reproduces the error. As indicated below and in the example script, I have verified this on 3 different AWS MySql-compatible RDS engines.

My example demos the case of a one-to-many relationship between two model types, mostly because that's how it is in my real-world use case, but it's possible that this could be pared down further, I just haven't had time to test that.

To Reproduce
Steps to reproduce the behavior:

  1. Download example project linked under "code snippets".
  2. Install pip dependencies.
  3. Set up a test mysql database somewhere with an empty schema masonite. (I've tested engines 5.7 & 8.0.)
  4. Configure test database params in config/database.py.
  5. Run migrations: masonite-orm migrate.
  6. Run example file: python example.py.

Expected behavior
Record update to the deleted_at field should succeed.

Screenshots or code snippets
I have created an example that repros this behavior here: https://github.com/DrewHood-isp/masonite-orm-example

What database are you using?

  • Type: MySql
  • Versions tested (all AWS RDS)
    • Aurora MySql 5.7
    • MySql Community 5.7
    • MySql Community 8.0
  • Masonite ORM 2.18.4
  • Python version 3.10

Additional context
N/a

@ghost ghost added the bug An existing feature is not working as intended label Aug 11, 2022
@ghost
Copy link
Author

ghost commented Oct 5, 2022

@josephmancuso Thanks for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An existing feature is not working as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

0 participants