Glancing at the PR, one thing I'm not sure about is renaming AutoField to SmallAutoField. I think that's going to cause needless additional complexity and confusion among people who've worked with Django a long time. For example, you might think that "Small" there has a similar meaning as SmallIntegerField. Did I miss the discussion about the benefits of the rename? If we agree to proceed with it, please split it out into a separate ticket/PR for easier review.
On Sunday, August 27, 2017 at 5:31:47 AM UTC-4, Adam Johnson wrote: > > I don't think "primary key size" is something that's even within > consideration for 99% of django apps. Sure a few more bytes are going to be > wasted here, but you could argue the same that the default AutoField was > already too big for most models that have 100's of instances and could use > even a one byte primary key. > > Defaulting to BigAutoField everywhere is the simple solution that stops > everyone from ever worrying about their tables filling up. Additionally > using compressed tables helps reclaim nearly all those unused bytes, at > least on MySQL. > > On 18 August 2017 at 17:14, Andrew Godwin <and...@aeracode.org > <javascript:>> wrote: > >> >> >> On Fri, Aug 18, 2017 at 5:43 AM, Markus Holtermann < >> in...@markusholtermann.eu <javascript:>> wrote: >>> >>> 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. >>> >>> >> This is also true of changing the primary key of third-party packages in >> general though - e.g. there's no way I can make everything use UUIDs even >> if my database would be way better at those. >> >> I don't see any other solutions that aren't settings doing >> spooky-action-at-a-distance to primary keys, and that's something I really >> don't want to see. >> >> Andrew >> >> >>> >>> 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 <m...@kennethreitz.org >>>> <javascript:>> 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 django-develop...@googlegroups.com <javascript:>. >>>>> To post to this group, send email to django-d...@googlegroups.com >>>>> <javascript:>. >>>>> 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 django-develop...@googlegroups.com <javascript:>. >>>> To post to this group, send email to django-d...@googlegroups.com >>>> <javascript:>. >>>> 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 django-develop...@googlegroups.com <javascript:>. >>> To post to this group, send email to django-d...@googlegroups.com >>> <javascript:>. >>> 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. >>> >> >> -- >> 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 django-develop...@googlegroups.com <javascript:>. >> To post to this group, send email to django-d...@googlegroups.com >> <javascript:>. >> 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/CAFwN1upjqjrqB4p778wkekLxz7F1P8HiroKe0zvdGjGzKkAKXg%40mail.gmail.com >> >> <https://groups.google.com/d/msgid/django-developers/CAFwN1upjqjrqB4p778wkekLxz7F1P8HiroKe0zvdGjGzKkAKXg%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Adam > -- 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 django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. 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/5ea03d29-c62e-4bd1-9846-75267cbb4573%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.