The code that calls it in table_sql, however, doesn't pass the argument so
always defaults to False.
https://github.com/django/django/blob/master/django/db/backends/base/schema.py#L155
As a result, it does not appear possible to turn on that flag for
migrations.
I have got this functionality working by subclassing the
DatabaseSchemaEditor and overriding the `column_sql` function to default
`include_default=True`.
--
Ticket URL: <https://code.djangoproject.com/ticket/30642>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
Ticket URL: <https://code.djangoproject.com/ticket/30642#comment:1>
* cc: Leo Shklovskii (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/30642#comment:2>
* status: new => closed
* type: Bug => Cleanup/optimization
* version: 2.2 => master
* resolution: => invalid
Comment:
Thanks for this report, however it is not a bug, it's rather a design
decision.
Django (for now) doesn't support default values on database level (see
[https://groups.google.com/forum/#!topic/django-
developers/3mcro17Gb40/discussion discussion]). That's why we don't add
`DEFAULT` clause on database creation because no rows would be affected.
We add `DEFAULT` clause when adding a new column to fill existing rows,
but we also immediately drop it after that (see
[https://github.com/django/django/blob/a3417282ac0464a9a2d1d7685bcfef10feed2597/django/db/backends/base/schema.py#L469-L476
add_field()]).
--
Ticket URL: <https://code.djangoproject.com/ticket/30642#comment:3>