Skip to content

Commit

Permalink
fix django 3.2 degradation
Browse files Browse the repository at this point in the history
  • Loading branch information
tbicr committed Apr 27, 2024
1 parent 3209249 commit 18d0bff
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# django-pg-zero-downtime-migrations changelog

## 0.15
- fixed django 3.2 degradation with missing `skip_default_on_alter` method

## 0.14
- fixed deferred sql errors
- added django 5.0 support
Expand Down
8 changes: 8 additions & 0 deletions django_zero_downtime_migrations/backends/postgres/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,14 @@ def _add_column_unique(self, model, field):
self.deferred_sql.append(self._create_unique_sql(model, [field.column]))
return ""

if django.VERSION[:2] <= (3, 2):
def skip_default_on_alter(self, field):
"""
Some backends don't accept default values for certain columns types
(i.e. MySQL longtext and longblob) in the ALTER COLUMN statement.
"""
return False

def column_sql(self, model, field, include_default=False):
"""
Take a field and return its column definition.
Expand Down

0 comments on commit 18d0bff

Please sign in to comment.