1
0
mirror of https://github.com/django/django.git synced 2025-07-04 17:59:13 +00:00

magic-removal: Removed section in django.core.management.get_sql_delete that deleted content types, permissions and admin log stuff -- that was coupled to those contrib apps

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2586 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-03-28 21:33:08 +00:00
parent 493f8b9e5b
commit 5372618b3c

View File

@ -304,31 +304,6 @@ def get_sql_delete(app):
app_label = app_models[0]._meta.app_label app_label = app_models[0]._meta.app_label
# TODO: Remove the following section.
# Delete from django_package, auth_permission, django_content_type.
if cursor and "django_content_type" in table_names:
# Grab a list of affected content-types
cursor.execute("SELECT id FROM django_content_type WHERE app_label = %s", [app_label])
affected_content_types = [r[0] for r in cursor.fetchall()]
# Remember do this this business in reverse order since the returned
# values are reversed below
output.append("DELETE FROM %s WHERE %s = '%s';" % \
(backend.quote_name('django_content_type'), backend.quote_name('app_label'), app_label))
if "auth_permission" in table_names:
for ctype_id in affected_content_types:
output.append("DELETE FROM %s WHERE %s = %s;" % \
(backend.quote_name("auth_permission"), backend.quote_name("content_type_id"), ctype_id))
# Delete from the admin log.
if "django_admin_log" in table_names:
for ctype_id in affected_content_types:
output.append("DELETE FROM %s WHERE %s = %s;" % \
(backend.quote_name("django_admin_log"), backend.quote_name("content_type_id"), ctype_id))
# Close database connection explicitly, in case this output is being piped # Close database connection explicitly, in case this output is being piped
# directly into a database client, to avoid locking issues. # directly into a database client, to avoid locking issues.
if cursor: if cursor: