BTW: RunPython() is another thing, which can break your migrations, and
should not be used (especially not by Django internally), because it relies
on the application layer.

How else can you do a data migration? There is no
`migrations.InsertIntoTable`, the only other way currently would be to run
a `migrations.RunSql` query which may look different based on the database
used.

Two things are wrong:

   - automatic creation of content types

Why is it wrong to automatically create a content type? Content type is an
opt-in feature since you can remove it from `INSTALLED_APPS`.


   - creation of content types after running migrations

That’s the only real problem for me. Maybe using a signal for
`migrations.CreateModel` (e.g. post_create_model), instead of using
`post_migrate` would fix it, but there may be other scenarios I’m not
thinking about.


Solution:

   - creation of new app should add very first migration, which will add
   entry to the content types

How would you handle creating a model later on? Or if
`django.contrib.contenttypes` is only added later on to `INSTALLED_APPS`?


Regards,

—

Arthur


On October 4, 2018 at 1:36:39 PM, Marcin Nowak (marcin.j.no...@gmail.com)
wrote:

Hi Aymeric.

Thank you for your reply.

Unfortunately you wrote mostly about me or my writing style, not about the
issue.
I disagree with your opinion about my comments being passive or aggressive.
I'm always writing about a piece of code, functionality,
design/architecture or bug. I never criticised a person directly.



> Starting with "There is a huge issue with content types framework" isn't a
> good way to motivate them.
>
>
But there is an issue with content types framework (not with it's authors).



> Speaking for myself, I would be more eager to investigate if you skipped
> the hyperbole and remained neutral, for example "I'm facing an issue with
> the content types framework".
>
>
Sorry hearing that. I'm not native English speaker.

For me there is almost no difference with these two sentences, except that
first is about the affected thing ("there is an issue with") and second is
more about me ("I have a problem").
Both are valid, I think. I have a problem which is caused by CT framework's
design or issue (in fact it comes from a historical reason, before
migrations era).


> You'd have more success if you managed to write in a positive style.
>

I don't think that my style is unpleasant. If it is - sorry for that.
I'm always trying to describe the problem and give some proposals.
But I'll try to improve this.


> I think the issue itself is valid. I may have hit it before and worked
> around it, likely be executing a subset of migrations to trigger creation
> of content types, then executing the rest of the migrations. Django could
> probably do better.
>
>
I'll generate CTs in very first migration. This will be a workaround, of
course.
But because Django uses migrations internally, CT's should be added to the
database in a same way.

And RunPython() can be problematic. I did something similar with Liquibase'
executeCommand, which was calling management command. And of course it
caused problems after changing app layer.
I'm very conservative about databases and managing them, I think that there
must be complete separation between db and app layer (in the context of
managing dbs), because app layer is changing frequently (more often than
dbs). Mixing both worlds will cause troubles. Always.

Kind Regards,
Marcin
--
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/0e4464f7-2ed7-4e6b-9b7e-f98a385dffd5%40googlegroups.com
<https://groups.google.com/d/msgid/django-developers/0e4464f7-2ed7-4e6b-9b7e-f98a385dffd5%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-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/CADOBPEGDbxpNnECnZMk-Ff51YX6T3drfm9MTBRS3gxmcEgQ1tg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to