diff options
Diffstat (limited to 'django/db/backends/mysql/features.py')
-rw-r--r-- | django/db/backends/mysql/features.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/django/db/backends/mysql/features.py b/django/db/backends/mysql/features.py index d4651516fe..e55d098057 100644 --- a/django/db/backends/mysql/features.py +++ b/django/db/backends/mysql/features.py @@ -17,7 +17,6 @@ class DatabaseFeatures(BaseDatabaseFeatures): supports_index_column_ordering = False supports_timezones = False requires_explicit_null_ordering_when_grouping = True - allows_auto_pk_0 = False can_release_savepoints = True atomic_transactions = False can_clone_databases = True @@ -52,6 +51,14 @@ class DatabaseFeatures(BaseDatabaseFeatures): return self.connection.mysql_server_data['default_storage_engine'] @cached_property + def allows_auto_pk_0(self): + """ + Autoincrement primary key can be set to 0 if it doesn't generate new + autoincrement values. + """ + return 'NO_AUTO_VALUE_ON_ZERO' in self.connection.sql_mode + + @cached_property def update_can_self_select(self): return self.connection.mysql_is_mariadb and self.connection.mysql_version >= (10, 3, 2) |