Ticket #1828: 1828.diff
File 1828.diff, 1.4 KB (added by , 18 years ago) |
---|
-
management.py
454 454 # Get a list of already installed *models* so that references work right. 455 455 seen_models = _get_installed_models(table_list) 456 456 created_models = set() 457 created_apps = set() 457 458 pending_references = {} 458 459 459 460 for app in models.get_apps(): … … 465 466 sql, references = _get_sql_model_create(model, seen_models) 466 467 seen_models.add(model) 467 468 created_models.add(model) 469 created_apps.add(app) 468 470 for refto, refs in references.items(): 469 471 try: 470 472 pending_references[refto].extend(refs) … … 512 514 transaction.rollback_unless_managed() 513 515 else: 514 516 transaction.commit_unless_managed() 517 518 # do indexes - doing it after initial sql, it should speed up the inserts on at least MySQL 519 # (i.e. one re-index rather than n re-indexes) 520 for app in created_apps: 521 print "Creating indexes for %s" % app.__name__ 522 for sql in get_sql_indexes(app): 523 try: 524 cursor.execute(sql) 525 except Exception, e: 526 sys.stderr.write("Failed to create index for %s app: %s" % app.__name__, e) 515 527 516 528 syncdb.args = ''