mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	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:
		| @@ -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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user