Ticket #4528: pre_syncdb_sql_hook.patch

File pre_syncdb_sql_hook.patch, 818 bytes (added by Johan Bergström <bugs@…>, 17 years ago)

database_pre_syncdb patch

  • django/core/management.py

     
    479479    data_types = get_creation_module().DATA_TYPES
    480480
    481481    cursor = connection.cursor()
     482   
     483    # Execute pre_syncdb sql.
     484    try:
     485        for statement in settings.DATABASE_PRE_SYNCDB:
     486            try:
     487                cursor.execute(statement)
     488            except Exception, e:
     489                sys.stderr.write("Failed to execute pre_syncdb sql for %s: %s\n" % \
     490                                (app_name, statement))
     491    # Be silent if pre_syncdb is unset.
     492    except AttributeError:
     493        pass
    482494
    483495    # Get a list of all existing database tables,
    484496    # so we know what needs to be added.
Back to Top