#24182: Bug with functional default and migrations
----------------------------+--------------------------------------
Reporter: arveitch | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.7
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------+--------------------------------------
Comment (by MarkusH):
You could use an undocumented (internal) API from the introspection to see
if the database table exists:
{{{#!python
In [1]: from django.db import connection
In [2]: connection.introspection.get_table_list(connection.cursor())
Out[2]: ['django_migrations', 'app_a_a1', 'app_a_a2']
}}}
Apart from that, your migration(s) will suffer from #23932, regardless of
whether you access the model or not.
1. Add the field with `unique=False, null=True, default=NOT_PROVIDED`
2. Propagate existing rows
3. Alter field to `unique=True, null=False, default=generateCode`
I don't think this, backwards incompatible, behavior explicitly needs to
be documented. Instead #23932 should be. That said, I'm inclined to close
this ticket as duplicate.
--
Ticket URL: <https://code.djangoproject.com/ticket/24182#comment:5>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/066.7b53315638b60a20e7f9c5681635e456%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.