Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#23961 closed Bug (fixed)

makemigrations doesn't create migrations package when app_label isn't specified

Reported by: dibrovsd Owned by: Tim Graham
Component: Documentation Version: 1.7
Severity: Normal Keywords: migration
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

in settings:

MIGRATION_MODULES = {
    'docflow': 'docflow_projects.migrations',
}

case 1) app docflow has no package "migrations"

  • ./manage.py makemigrations

initial migration not create

case 2) app docflow has package "migrations"

  • run "./manage.py makemigrations"

created initial migration in docflow_projects.migrations 0001_initial (ok)

  • run "./manage.py makemigrations"

create migration deleted all field and models in app! 0002_auto_20141205_1349 (error)

  • run "./manage.py makemigrations"

raise
CommandError: Conflicting migrations detected (0002_auto_20141205_1349, 0001_initial in docflow).

case 3)
run ./manage.py makemigrations docflow
it's ok

Change History (5)

comment:1 by Tim Graham, 10 years ago

Easy pickings: unset
Summary: MIGRATION_MODULES and makemigration with no argumentsmakemigrations doesn't create migrations package when app_label isn't specified
Triage Stage: UnreviewedAccepted
Type: UncategorizedBug

It seems the fix for #22682 (allowing makemigrations to create the migrations package) only works if you specify the app_label. We should either update the documentation that was added as part of that ticket (in docs/ref/settings.txt) or see if we can make package creation happen when using makemigrations without an app_label.

I couldn't tell if there were any more problems besides that in your report. If so, a separate ticket may be appropriate.

comment:2 by Carl Meyer, 10 years ago

I thought that until support for apps without migrations was removed, it was intentional that makemigrations would only create the migrations module if you gave it an app-label (I think that's the behavior with or without MIGRATION_MODULES set). Otherwise it would be very difficult to use migrated apps alongside unmigrated apps in the same project. I think the plan is in Django 1.9 (when support for unmigrated apps goes away), makemigrations should start always creating the migration module.

I'm not entirely sure about that, but that was my understanding. If that's the case, there still may be a documentation update needed.

comment:3 by Tim Graham, 10 years ago

Component: MigrationsDocumentation
Owner: changed from nobody to Tim Graham
Status: newassigned

comment:4 by Tim Graham <timograham@…>, 10 years ago

Resolution: fixed
Status: assignedclosed

In fa6e3a40e1866b64eb30e0dfbd43b340c0d831da:

Fixed #23961 -- Clarified when makemigrations will create a directory.

comment:5 by Tim Graham <timograham@…>, 10 years ago

In da562d6a8785d28b75475c1c3d1eb5987253bc35:

[1.7.x] Fixed #23961 -- Clarified when makemigrations will create a directory.

Backport of fa6e3a40e1866b64eb30e0dfbd43b340c0d831da from master

Note: See TracTickets for help on using tickets.
Back to Top