#24278: squashmigrations throws ValueError: need more than 1 value to unpack
----------------------------+--------------------
     Reporter:  riklaunim   |      Owner:  nobody
         Type:  Bug         |     Status:  new
    Component:  Migrations  |    Version:  1.7
     Severity:  Normal      |   Keywords:
 Triage Stage:  Unreviewed  |  Has patch:  0
Easy pickings:  0           |      UI/UX:  0
----------------------------+--------------------
 When squashing several migrations I got an exception during
 squashmigrations:
 {{{
 Traceback (most recent call last):
   File "/env/bin/django-admin.py", line 5, in <module>
     management.execute_from_command_line()
   File "/env/lib/python3.4/site-
 packages/django/core/management/__init__.py", line 385, in
 execute_from_command_line
     utility.execute()
   File "/env/lib/python3.4/site-
 packages/django/core/management/__init__.py", line 377, in execute
     self.fetch_command(subcommand).run_from_argv(self.argv)
   File "/env/lib/python3.4/site-packages/django/core/management/base.py",
 line 288, in run_from_argv
     self.execute(*args, **options.__dict__)
   File "/env/lib/python3.4/site-packages/django/core/management/base.py",
 line 338, in execute
     output = self.handle(*args, **options)
   File "/env/lib/python3.4/site-
 packages/django/core/management/commands/squashmigrations.py", line 122,
 in handle
     fh.write(writer.as_string())
   File "/env/lib/python3.4/site-packages/django/db/migrations/writer.py",
 line 130, in as_string
     operation_string, operation_imports =
 OperationWriter(operation).serialize()
   File "/env/lib/python3.4/site-packages/django/db/migrations/writer.py",
 line 87, in serialize
     arg_string, arg_imports = MigrationWriter.serialize(arg_value)
   File "/env/lib/python3.4/site-packages/django/db/migrations/writer.py",
 line 260, in serialize
     item_string, item_imports = cls.serialize(item)
   File "/env/lib/python3.4/site-packages/django/db/migrations/writer.py",
 line 327, in serialize
     return cls.serialize_deconstructed(*value.deconstruct())
   File "/env/lib/python3.4/site-packages/django/db/migrations/writer.py",
 line 223, in serialize_deconstructed
     module, name = path.rsplit(".", 1)
 ValueError: need more than 1 value to unpack
 }}}

 The "path" variable got a value of "RenameField" instead of
 django.something.someField. I found one "migrations.RenameField" in the
 migrations set and after removing it (and "migrations.AlterField" which
 also caused such exception) the squash passed.

 The migration (operations) with those fields looks like so:

 {{{
 operations = [
         migrations.SeparateDatabaseAndState(state_operations=[
             migrations.RenameField(
                 model_name='somemodel',
                 old_name='some_old_name',
                 new_name='new_name',
             ),
             migrations.AlterField(
                 model_name='somemodel',
                 name='new_name',
                 field=models.BooleanField(db_column='some_old_name',
 default=False),
                 preserve_default=True,
             ),
         ]),
     ]
 }}}

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

Reply via email to