Thanks for taking the effort to work on this, Kenneth!
I'm don't fully agree with the approach. This essentially forces 3rd
party package authors to make the call about the primary key field size.
While for small to medium size projects BigAutoField is unlikely
required and only comes with additional (storage) costs. Given that the
migrations would need to be part of the 3rd party package there's also
no (trivial) way for project developers to force or change to
SmallAutoField for those packages. The same thing holds the other way
round.
Unfortunately, I don't have another solution at hand.
I realized that I'm a bit late to the discussion and should've chimed
in before all that work was done. Please accept my apologies for that.
/Markus
On Thu, Aug 17, 2017 at 02:43:07PM -0700, Andrew Godwin wrote:
To elaborate on the solution we eventually came up with - we default models
to use a new BigAutoField that migrations will pick up on and generate
migrations to alter columns to, but for safety reasons for those that don't
read release notes, made the migration autodetector ask you if you want to
make these migrations with a slowness warning.
It also tells you how to preserve the old behaviour and avoid new
migrations if you wish (manually set id = SmallAutoField)
I like this approach as it means no new settings or Meta options or
anything, has a reasonable upgrade path, and won't let people unwittingly
wander into giant changes. The downside is that it does add slightly more
friction to the upgrade process.
Andrew
On Thu, Aug 17, 2017 at 2:36 PM, Kenneth Reitz <[email protected]> wrote:
I have opened a pull request:
https://github.com/django/django/pull/8924
Andrew and I came up with a good solution for migrations, together at
DjangoCon.
On Wednesday, June 14, 2017 at 7:36:36 AM UTC-7, Melvyn Sopacua wrote:
On Friday 09 June 2017 15:59:50 Kenneth Reitz wrote:
> However, it should also be noted that those same larger applications
> are the ones that are likely to run into this problem eventually, so
> perhaps forcing the migration is the best path moving forward.
Existing models are the problem. Then again the database knows the truth.
So with a little inspection during apps.get_models we might be able to do
the right thing and even allow migrating in steps.
Apps is also the place to mark an app as migrated.
In fact - couldn't an AppConfig grow a method "get_autoid_type()" and
inject the right one?
You asked fr thoughts, so there's my 2c stream.
--
Melvyn Sopacua
--
You received this message because you are subscribed to the Google Groups
"Django developers (Contributions to Django itself)" 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].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/
msgid/django-developers/e3effc41-10e1-42e2-9037-
84c98217cd91%40googlegroups.com
<https://groups.google.com/d/msgid/django-developers/e3effc41-10e1-42e2-9037-84c98217cd91%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Django
developers (Contributions to Django itself)" 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].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-developers/CAFwN1uo4Y_pWSf3zAe_4R0GGkDqBv1YGus8Q%2BWPPZ%3DZ6FPwdYQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Django
developers (Contributions to Django itself)" 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].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-developers/20170818124354.GA1898%40inel.local.
For more options, visit https://groups.google.com/d/optout.