|
@ -26,8 +26,6 @@ from mumble.management.server_detect import find_existing_instances |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def update_schema( **kwargs ): |
|
|
def update_schema( **kwargs ): |
|
|
cursor = connection.cursor() |
|
|
|
|
|
|
|
|
|
|
|
scriptpath = join( |
|
|
scriptpath = join( |
|
|
settings.MUMBLE_DJANGO_ROOT, "pyweb", "mumble", "conversionsql", { |
|
|
settings.MUMBLE_DJANGO_ROOT, "pyweb", "mumble", "conversionsql", { |
|
|
'postgresql_psycopg2': 'pgsql', |
|
|
'postgresql_psycopg2': 'pgsql', |
|
@ -41,10 +39,13 @@ def update_schema( **kwargs ): |
|
|
scripts.sort() |
|
|
scripts.sort() |
|
|
|
|
|
|
|
|
for filename in scripts: |
|
|
for filename in scripts: |
|
|
|
|
|
cursor = connection.cursor() |
|
|
|
|
|
|
|
|
scriptfile = open( os.path.join( scriptpath, filename ), "r" ) |
|
|
scriptfile = open( os.path.join( scriptpath, filename ), "r" ) |
|
|
try: |
|
|
try: |
|
|
stmt = scriptfile.read() |
|
|
stmt = scriptfile.read() |
|
|
cursor.execute( stmt ) |
|
|
cursor.execute( stmt ) |
|
|
|
|
|
if "postgresql" in settings.DATABASE_ENGINE: |
|
|
transaction.commit() |
|
|
transaction.commit() |
|
|
|
|
|
|
|
|
except IOError, err: |
|
|
except IOError, err: |
|
@ -54,9 +55,11 @@ def update_schema( **kwargs ): |
|
|
except cursor.db.connection.Error, err: |
|
|
except cursor.db.connection.Error, err: |
|
|
print "Error executing file '%s':" % filename |
|
|
print "Error executing file '%s':" % filename |
|
|
print err |
|
|
print err |
|
|
|
|
|
if "postgresql" in settings.DATABASE_ENGINE: |
|
|
transaction.rollback() |
|
|
transaction.rollback() |
|
|
|
|
|
|
|
|
finally: |
|
|
finally: |
|
|
scriptfile.close() |
|
|
scriptfile.close() |
|
|
|
|
|
cursor.close() |
|
|
|
|
|
|
|
|
find_existing_instances( **kwargs ) |
|
|
find_existing_instances( **kwargs ) |