-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
Fixes #27676 -- Made MySQL backend allow database level defaults for text/blob/json columns on MariaDB 10.2+ #7778
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
Conversation
2169f45
to
7f587dd
Compare
django/db/backends/mysql/base.py
Outdated
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.
Missing self
:)
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.
Yeah, woops, I wrote this on a train without a working local mariadb so didn't run tests
I haven't yet tested this on MariaDB 10.2. Also this brings up the question of whether Django CI should start testing on MariaDB as well as MySQL 😉 |
django/db/backends/mysql/schema.py
Outdated
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.
Shouldn't this be a feature flag and to allow a Maria DB specific backend to override it?
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.
I think adding a MariaDB backend would be a good idea eventually but first I'd like to get Django using pymysql
as well, which I have half-done at https://github.com/adamchainz/django-pymysql-backend . But then we'd possibly have 2 MySQL backends and 2 MariaDB backends inheriting from them 😞 .
…text/blob/json columns on MariaDB 10.2+
7f587dd
to
b2fe85c
Compare
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.
I guess it's fine provided you test it.
match = server_version_re.match(server_info) | ||
return cursor.fetchone()[0] | ||
|
||
@property |
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.
Should the new properties be cached?
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.
maybe mysql_version
but mysql_is_mariadb
is very simple
treats these columns as nullable. | ||
treats these columns as nullable. MariaDB 10.2+ fixes this. | ||
""" | ||
if self.connection.mysql_is_mariadb and self.connection.mysql_version[:2] > (10, 2): |
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.
I think [:2]
is unnecessary.
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.
yes it is, just a habit
|
||
def skip_default(self, field): | ||
""" | ||
MySQL doesn't accept default values for some data types and implicitly |
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.
I'd say, "MySQL (except MariaDB 10.2+) doesn't ..."
Adam, do you want to finish this up? |
I do, but I was thinking of forming a better plan around MariaDB first... |
Reopen this when you return to it? |
Sure
…On 2 June 2017 at 00:47, Tim Graham ***@***.***> wrote:
Closed #7778 <#7778>.
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#7778 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AA0WCefowaerVScXWogOAFrH9xgl6c1qks5r_02egaJpZM4LZJ-z>
.
--
Adam
|
Ticket