Ticket #1440: management.diff

File management.diff, 1.1 KB (added by Malcolm Tredinnick <malcolm@…>, 9 years ago)

Send multiple SQL statements one at a time to backend.

  • django/core/management.py

     
    424424            created_models.add(model)
    425425            pending_references.update(references)
    426426            sql.extend(_get_sql_for_pending_references(model, pending_references))
    427             sql = "\n".join(sql)
    428427            print "Creating table %s" % model._meta.db_table
    429             cursor.execute(sql)
     428            for statement in sql:
     429                cursor.execute(statement)
    430430
    431431        for model in model_list:
    432432            if model in created_models:
    433433                sql = _get_many_to_many_sql_for_model(model)
    434434                if sql:
    435                     sql = '\n'.join(sql).strip()
    436435                    print "Creating many-to-many tables for %s model" % model.__name__
    437                     cursor.execute(sql)
     436                    for statement in sql:
     437                        cursor.execute(statement)
    438438
    439439    transaction.commit_unless_managed()
    440440syncdb.args = ''
Back to Top