#28785: Tracking migrations
-----------------------------------------+------------------------
               Reporter:  Ramez Kabbani  |          Owner:  nobody
                   Type:  Uncategorized  |         Status:  new
              Component:  Migrations     |        Version:  1.11
               Severity:  Normal         |       Keywords:
           Triage Stage:  Unreviewed     |      Has patch:  0
    Needs documentation:  0              |    Needs tests:  0
Patch needs improvement:  0              |  Easy pickings:  0
                  UI/UX:  0              |
-----------------------------------------+------------------------
 Migrations exist in django in two locations:
 1. In the codebase under app_name/migrations
 2. As a db entry in django_migrations

 I've come across the following scenario where I expected Django to give an
 error but it didn't not.

 Assume we have 4 migrations for an app, and migration 1 through 3 are
 applied.


 {{{
 # Content of Postgres DB

     32 | app_name     | 0001_initial
     33 | app_name    | 0002_migration2
     34 | app_name     | 0003_migration3
 }}}

 All migrations except 0001_initial.py were deleted including the folder
 pycache. We then run makemigrations


 {{{
 # Contents of migration folder after makemigrations was ran.

 0001_initial.py  0002_name.py  __init__.py  __pycache__

 # Run makemigrations
 No Changes Detected

 # Output of showmigrations

     app_name
     [X] 0001_initial
     [X] 0002_name
 }}}

 Contents of Postgres django_migrations, however, remain unchanged still
 with an entry for a third migration. I expected an error in one of the
 following commands but received none: makemigrations, migrate,
 showmigrations.

 Also, migrate --fake app_name 0002_name does not lead to the deletion of
 0003_migration3 entry in django_migrations

-- 
Ticket URL: <https://code.djangoproject.com/ticket/28785>
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/055.7b416c801809883070be6158818bdd66%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to