#24375: Add ability to mark migration as "part of initial" in Migration
---------------------------------+------------------------------------
     Reporter:  haeric           |                    Owner:  nobody
         Type:  New feature      |                   Status:  new
    Component:  Migrations       |                  Version:  1.7
     Severity:  Normal           |               Resolution:
     Keywords:  fake migrations  |             Triage Stage:  Accepted
    Has patch:  0                |      Needs documentation:  0
  Needs tests:  0                |  Patch needs improvement:  0
Easy pickings:  0                |                    UI/UX:  0
---------------------------------+------------------------------------
Changes (by carljm):

 * needs_better_patch:   => 0
 * stage:  Unreviewed => Accepted
 * needs_tests:   => 0
 * needs_docs:   => 0


Comment:

 I think there is a reasonable feature request here, except that it should
 not be an "always-fake" attribute. This doesn't really make conceptual
 sense, since the need for faking is never inherent in a migration, it
 always depends on the state of the database the migration is run against.
 In your particular situation, it may be true that you will only ever run
 these migrations against existing databases (I guess you don't use
 Django's test runner?), but that's an unusual scenario (and I doubt it's
 even true in your case -- you'll never again ever spin up a new
 environment of this app?)

 The version of this that makes sense to me is a migration attribute that
 says "I should be considered a part of the initial migration, for purposes
 of auto-faking when Django detects that the tables for this app already
 exist."

 I would suggest that this attribute be named `initial`, and always be set
 on the actual initial migration too. Then there is no longer any implicit
 special-casing of the first migration; the auto-fake behavior would just
 auto-fake until it reaches a migration without `initial = True`.

 Making this change would allow us to get rid of the special case mentioned
 in the documentation, where sometimes if two initial migrations are
 created you have to manually fake the second one.

--
Ticket URL: <https://code.djangoproject.com/ticket/24375#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" 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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.d40c547d07d56aa22649c54be671449a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to