#34217: Migration removing a CheckConstraint results in ProgrammingError using
MySQL < 8.0.16.
----------------------------+------------------------------------
     Reporter:  Max F.      |                    Owner:  nobody
         Type:  Bug         |                   Status:  new
    Component:  Migrations  |                  Version:  4.1
     Severity:  Normal      |               Resolution:
     Keywords:              |             Triage Stage:  Accepted
    Has patch:  0           |      Needs documentation:  0
  Needs tests:  0           |  Patch needs improvement:  0
Easy pickings:  0           |                    UI/UX:  0
----------------------------+------------------------------------
Changes (by Mariusz Felisiak):

 * stage:  Unreviewed => Accepted


Comment:

 Thanks for the report. Agreed, removing a check constraint should be no-op
 when not supported, the following diff fix it for me:
 {{{#!diff
 diff --git a/django/db/backends/base/schema.py
 b/django/db/backends/base/schema.py
 index fe31967ce2..8e6c21647e 100644
 --- a/django/db/backends/base/schema.py
 +++ b/django/db/backends/base/schema.py
 @@ -1667,6 +1667,8 @@ class BaseDatabaseSchemaEditor:
          )

      def _delete_check_sql(self, model, name):
 +        if not self.connection.features.supports_table_check_constraints:
 +            return None
          return self._delete_constraint_sql(self.sql_delete_check, model,
 name)

      def _delete_constraint_sql(self, template, model, name):

 }}}
 Would you like to prepare a patch? (a regression test in
 `migrations.test_operations.OperationTests` is required.)

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34217#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018528c866b0-f47df7e8-3e48-4d5d-8015-5b6ac9c74f60-000000%40eu-central-1.amazonses.com.

Reply via email to