-
Notifications
You must be signed in to change notification settings - Fork 58
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
Initial MySQL support (early draft) #89
Conversation
I'm not a maintainer but have been contributing, so all decisions rest with @PetrDlouhy. I am impressed with the ambition of the PR. Recommendations
Thoughts? |
Hi @Joshun, thank you very much for this great work and such helpful enhancement of this application. HordakArrayFieldI agree with @nitsujri that maintaing whole new field type just for MySQL would be complicated.
Can the new field handle such code? If we would want to make bigger change it is also worth thinking about alternatives. This all said, I am not sure if this is not out of scope of this PR. TriggersRegarding the triggers, I think that it is quite OK to have implemented them in the migrations the same way as triggers for PostgreSQL. CI testsAs @nitsujri wrote, in order to accept this PR it would be needed to modify the CI specs to run all tests also on MySQL as well as adding tests for any added new feature. |
@PetrDlouhy very fair question - I claimed it was a drop in replacement but is it truly so? Almost is the proper answer. Changes are:
I also added the specs to cover the So, if we decide to accept MySQL - I do recommend pushing through to Thoughts? |
Thanks for the kind feedback @nitsujri and @PetrDlouhy - I think the first step is probably for me to add the MySQL CI tests, and then if we do decide to opt for further changes to JSONField etc. we can verify if they still pass. |
Just marked it as ready for review because I thought it would trigger the workflows but looks like that isn't the case, I'll setup the workflows in my own repo and see if I can get them working |
MariaDB testing MariaDB testing (2) custom healthcheck command custom healthcheck command (2) custom healthcheck command (3) custom healthcheck command (4) root password run as root run as root (2) run as root (3) mariadb-client mariadb-client (2)
All tests passing in MariaDB apart from one of the lint tests Meant to ask - I'm sure there was a very good reason, but why was an ArrayField used for currencies instead of a join table? (though this is someone coming from a MySQL background) |
Codecov ReportPatch coverage:
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. Additional details and impacted files@@ Coverage Diff @@
## master #89 +/- ##
==========================================
- Coverage 92.45% 91.91% -0.54%
==========================================
Files 57 57
Lines 3513 3613 +100
Branches 222 243 +21
==========================================
+ Hits 3248 3321 +73
- Misses 223 241 +18
- Partials 42 51 +9
☔ View full report in Codecov by Sentry. |
For the linters you can run precommit. Basically does everything for you.
Hrm, probably have to ask @adamcharnock, but I'll flip the question, what would be gained by normalizing the currency column? |
| but why was an ArrayField used for currencies instead of a join table? I don't have any idea too and as I have already written, join table would be much easier to work with when implementing running totals (PR #76). If there isn't any strong reason for using ArrayField I see join table to be much cleaner option. |
@PetrDlouhy looks like you're having the same issue on the CI for MariaDB that we've had here in the past couple of days - I think MariaDB have changed a parameter in their image that has caused the healthchecks to stop working. For now I'd suggest changing the |
Oops wrong PR |
Closed as was superseded by #91 |
Hi,
I might be able to provide a contribution for Hordak to support MySQL. We are thinking of potentially using django-hordak for some internal tools, but are heavily coupled to MySQL. I've had to make a few big changes though so I thought I'd outline them here - I'm not expecting this to be accepted in it's current form:
connection.vendor
and running either the MySQL or Postgres version depending on the db. Obviously it's not ideal changing migrations but I don't really see any way around this as in it's current form, the migrations would try to run and MySQL and fail. The Postgres triggers / procedures have been kept intact so Postgres users shouldn't notice any differenceLeg
andAccount
I've had to add extra behaviour to thesave
method to trigger MySQL stored procedures if the connection type ismysql
. This is because MySQL does not support deferred transactional triggers (only before or after every row insert/update/delete) so triggers likecheck_leg
would not work as triggers aloneLet me know your thoughts. I'm not expecting this to be accepted but feedback would be useful and any thoughts on how to integrate the two database systems cleanly. All tests passing on my local machine at time of opening this on both Postgres and MySQL.
Note your CI tests probably won't cover this fully, I'm assuming they are just set up to test Postgres and not MySQL.