Since this proposal seems to be broadly supported, I've created a
corresponding ticket and pull request:
https://code.djangoproject.com/ticket/31516 and
https://github.com/django/django/pull/12799 .

Thanks all.

On Sat, 25 Apr 2020 at 19:08, Tom Forbes <t...@tomforb.es> wrote:

> I would be in favour of Adam’s proposed changes. Adding more context to
> them and stripping the appended timestamp would make them more user
> friendly.
>
> > As a developer I would like to know who generated the code. If a
> migration is auto-generated, I would like to know that. I checked and
> auto-generated migrations in my project have a comment such as "# Generated
> by Django 2.1.15 on 2020-01-21 15:31".
>
> A couple of things:
> 1. Your VCS will tell you who generated the code
> 2. The name of the file including “auto” in it doesn’t mean that it wasn’t
> completely edited by a developer afterwards, making the “auto” useless in
> knowing who generated the code
>
> A common operation when looking at a list of migrations is to try and find
> a specific one. I think this is a much more common occurrence than looking
> at the list of migrations to know how many have been (possibly) generates
> by Django.
>
> This would make the common case more convenient and simpler, which is good.
>
> Tom
>
> On 25 Apr 2020, at 17:45, אורי <u...@speedy.net> wrote:
>
> 
>
>
> On Sat, Apr 25, 2020 at 5:48 PM Adam Johnson <m...@adamj.eu> wrote:
>
>> Re: Uri:
>>
>>> If the file name is not like ‘auto’ name with the current date + time,
>>> it looks like a migration which was written by a developer.
>>>
>>
>> I think making a distinction between "auto generated" and "hand written"
>> migrations is a bad idea. Django's makemigrations is a code generator, but
>> as a developer you're still responsible for the code. The autodetector
>> isn't perfect, and perhaps never can be. Even "simple" cases like adding a
>> through table to a ManyToManyField are autodetected "incorrectly" ( a real
>> migration needs SeparateDatabaseAndState
>> https://docs.djangoproject.com/en/3.0/howto/writing-migrations/#changing-a-manytomanyfield-to-use-a-through-model
>> ).
>>
>> I fear marking "auto generated" migrations differently would just
>> encourage (more) lax use of migrations files without reading their content,
>> which invites more risk for data loss and anger with Django for not being
>> perfect.
>>
> As a developer I would like to know who generated the code. If a migration
> is auto-generated, I would like to know that. I checked and auto-generated
> migrations in my project have a comment such as "# Generated by Django
> 2.1.15 on 2020-01-21 15:31". In most cases auto-generated migrations are
> good and don't need to be edited by a developer. So, I would prefer the
> migration file names to be auto-generated too (‘auto’ name with the current
> date + time).
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/CABD5YeFvWJSotjqhB_L%3Dt9i%3Dx3%3DRt%2Bh-S_gYCAgTV3C8RFMjwg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-developers/CABD5YeFvWJSotjqhB_L%3Dt9i%3Dx3%3DRt%2Bh-S_gYCAgTV3C8RFMjwg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/CC4B31C7-EC63-4531-BF69-3672B9909133%40tomforb.es
> <https://groups.google.com/d/msgid/django-developers/CC4B31C7-EC63-4531-BF69-3672B9909133%40tomforb.es?utm_medium=email&utm_source=footer>
> .
>


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAMyDDM0wj%3DsEqmMBuaom6bHsL4SRysx951zzJRbokkHCfebHag%40mail.gmail.com.

Reply via email to