On Saturday 11 January 2014 11:45:55 Andrew Godwin wrote: > OK, I like that approach Russ - an inverted 1b. It'll be a bit harder to > explain in the docs, but it won't catch anyone out unawares, which is the > key thing. > I like it too.
And foot-in-mouth re referencing swappables notwithstanding, there's two points I want to raise: 1) This approach is good for the models files; I think a more explicit approach should be taken for the migration files, where we don't currently have to worry about backwards compatibility. I'd like to see swappable=None in the model transformed to swappable=True in the migration, and swappable=None in the migration treated as an error. In particular, I don't like Marc's idea about migrations continuing to work when a target model, which used to be non-swappable, is being swapped out. The app's "main" code won't continue to work in this scenario, for reasons Russ has noted; I don't see why migrations should not be treated as part of the app's code. 2) Swappability of foreign-key targets in migrations may induce dynamic migration dependencies (if my migration creates a foreign key to the user model, and that model happens to be in a migrated app, my migration now depends on some -- not even necessarily the initial -- migration in that app; we'll only know at migrate time, not at makemigration time). I'd like to make this more explicit too -- e.g. add some placeholder, or a function call to calculate the dependency, in the generated list of dependencies. Although in principle it can be induced from the operations, I think it would make possible migration dependency issues much easier to troubleshoot. An alternative would to decree that swappable-replacement models cannot live in migrated apps; I think that is a very bad option. Shai. -- You received this message because you are subscribed to the Google Groups "Django developers" 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 http://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/138953391.ZAfFGT0eZV%40deblack. For more options, visit https://groups.google.com/groups/opt_out.