Improved django.core.management.get_sql_delete to close database connection explicitly when it's done, to avoid locking issues
git-svn-id: http://code.djangoproject.com/svn/django/trunk@823 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
474cfe56d4
commit
29ff2bb4cb
|
@ -144,6 +144,10 @@ def get_sql_delete(mod):
|
|||
for row in cursor.fetchall():
|
||||
output.append("DELETE FROM auth_admin_log WHERE content_type_id = %s;" % row[0])
|
||||
|
||||
# Close database connection explicitly, in case this output is being piped
|
||||
# directly into a database client, to avoid locking issues.
|
||||
db.db.close()
|
||||
|
||||
return output[::-1] # Reverse it, to deal with table dependencies.
|
||||
get_sql_delete.help_doc = "Prints the DROP TABLE SQL statements for the given model module name(s)."
|
||||
get_sql_delete.args = APP_ARGS
|
||||
|
|
Loading…
Reference in New Issue