#36643: Migrate should not check for consistent history when faking migrations
-----------------------------------+--------------------------------------
     Reporter:  Alexandru Chirila  |                    Owner:  (none)
         Type:  Bug                |                   Status:  new
    Component:  Migrations         |                  Version:  5.2
     Severity:  Normal             |               Resolution:
     Keywords:                     |             Triage Stage:  Unreviewed
    Has patch:  0                  |      Needs documentation:  0
  Needs tests:  0                  |  Patch needs improvement:  0
Easy pickings:  1                  |                    UI/UX:  0
-----------------------------------+--------------------------------------
Comment (by Augusto):

 Hi, good evening, i tried to replicate what you did, and i believe that i
 came up with a simple solution, that can ignore the
 {{{check_consistent_history}}}, and basically heres what i did: i searched
 into the{{{django/core/management/commands/migrate.py}}} and
 {{{django/core/management/commands/makemigrations.py}}} path, and i add
 this command line here at the {{{add_arguments}}}(on both paths) method:


 {{{
 parser.add_argument(
       '--bypass-consistency-check',
        action='store_true',
         dest='bypass_consistency_check',
         help='Bypass the migration history consistency check. Use with
 caution.',
    )
 }}}

 and on the {{{handle}}} method at the
 {{{django/core/management/commands/migrate.py}}} i changed this part:

 (line: 124)
 {{{
 # Raise an error if any migrations are applied before their
 # dependencies.
    if not options['bypass_consistency_check']:
        executor.loader.check_consistent_history(connection)
 }}}


 at the {{{django/core/management/commands/makemigrations.py}}} i edited
 this line here, before the verification:

 (line: 155)
 {{{
         if not options['bypass_consistency_check']:
             for alias in sorted(aliases_to_check):
             ....
 }}}

 to test this, you can type on the terminal:
 {{{
 python makemigrations.py your_app --bypass-consistency-check
 }}}

 {{{
 python manage.py migrate your_app your_migration_file --fake --bypass-
 consistency-check
 }}}

 see if this works
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36643#comment:3>
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 view this discussion visit 
https://groups.google.com/d/msgid/django-updates/01070199c492e3fd-b91c4781-c7fb-46e0-9c26-2819ed843020-000000%40eu-central-1.amazonses.com.

Reply via email to