#24071: Error with sqlmigrate
----------------------------+--------------------
     Reporter:  djbug       |      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
----------------------------+--------------------
 I have an app where I create a simple table and then add a partial index
 directly in SQL using RunSQL & migrations. I get an error with
 `sqlmigrate` when I use it on a custom migration.

 The command is : `manage.py sqlmigrate myapp 0002_custom.py`

 0002_custom.py files looks like this:



 {{{
 class Migration(migrations.Migration):

     dependencies = [
         ('myapp', '0001_initial'),
     ]

     operations = [
         migrations.RunSQL(
             sql = 'CREATE UNIQUE INDEX test_idx ON book (name,
 publisher_id) WHERE publisher_id IS NOT NULL;',
         )
     ]

 }}}

 Here's the error:

 {{{
 (django1_7) C:\djangoproject>python manage.py sqlmigrate myapp 0002

 Traceback (most recent call last):
   File "manage.py", line 10, in <module>
     execute_from_command_line(sys.argv)
   File "C:\virtualenv\django1_7\lib\site-
 packages\django\core\management\__init__.py", line 385, in
 execute_from_command_line
     utility.execute()
   File "C:\virtualenv\django1_7\lib\site-
 packages\django\core\management\__init__.py", line 377, in execute
     self.fetch_command(subcommand).run_from_argv(self.argv)
   File "C:\virtualenv\django1_7\lib\site-
 packages\django\core\management\base.py", line 288, in run_from_argv
     self.execute(*args, **options.__dict__)
   File "C:\virtualenv\django1_7\lib\site-
 packages\django\core\management\commands\sqlmigrate.py", line 30, in
 execute
     return super(Command, self).execute(*args, **options)
   File "C:\virtualenv\django1_7\lib\site-
 packages\django\core\management\base.py", line 338, in execute
     output = self.handle(*args, **options)
   File "C:\virtualenv\django1_7\lib\site-
 packages\django\core\management\commands\sqlmigrate.py", line 61, in
 handle
     sql_statements = executor.collect_sql(plan)
   File "C:\virtualenv\django1_7\lib\site-
 packages\django\db\migrations\executor.py", line 77, in collect_sql
     migration.apply(project_state, schema_editor, collect_sql=True)
   File "C:\virtualenv\django1_7\lib\site-
 packages\django\db\migrations\migration.py", line 107, in apply
     operation.database_forwards(self.app_label, schema_editor,
 project_state, new_state)
   File "C:\virtualenv\django1_7\lib\site-
 packages\django\db\migrations\operations\special.py", line 69, in
 database_forwards
     schema_editor.execute(statement, params=None)
   File "C:\virtualenv\django1_7\lib\site-
 packages\django\db\backends\schema.py", line 96, in execute
     self.collected_sql.append((sql % tuple(map(self.quote_value, params)))
 + ";")
 TypeError: argument 2 to map() must support iteration

 }}}

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

Reply via email to