Author: adrian Date: 2006-04-23 16:45:36 -0500 (Sun, 23 Apr 2006) New Revision: 2732
Modified: django/branches/magic-removal/django/core/management.py django/branches/magic-removal/django/db/backends/ado_mssql/base.py django/branches/magic-removal/django/db/backends/dummy/base.py django/branches/magic-removal/django/db/backends/mysql/base.py django/branches/magic-removal/django/db/backends/postgresql/base.py django/branches/magic-removal/django/db/backends/sqlite3/base.py Log: magic-removal: Fixed #1373 -- Factored out database-specific 'DROP CONSTRAINT' syntax, to get sqlreset/sqlclear working with MySQL. Thanks, njharman Modified: django/branches/magic-removal/django/core/management.py =================================================================== --- django/branches/magic-removal/django/core/management.py 2006-04-23 21:30:04 UTC (rev 2731) +++ django/branches/magic-removal/django/core/management.py 2006-04-23 21:45:36 UTC (rev 2732) @@ -290,7 +290,7 @@ output.append('%s %s %s %s;' % \ (style.SQL_KEYWORD('ALTER TABLE'), style.SQL_TABLE(backend.quote_name(table)), - style.SQL_KEYWORD('DROP CONSTRAINT'), + style.SQL_KEYWORD(backend.get_drop_foreignkey_sql()), style.SQL_FIELD(backend.quote_name("%s_referencing_%s_%s" % (col, r_table, r_col))))) del references_to_delete[klass] Modified: django/branches/magic-removal/django/db/backends/ado_mssql/base.py =================================================================== --- django/branches/magic-removal/django/db/backends/ado_mssql/base.py 2006-04-23 21:30:04 UTC (rev 2731) +++ django/branches/magic-removal/django/db/backends/ado_mssql/base.py 2006-04-23 21:45:36 UTC (rev 2732) @@ -121,6 +121,9 @@ def get_random_function_sql(): return "RAND()" +def get_drop_foreignkey_sql(): + return "DROP CONSTRAINT" + OPERATOR_MAPPING = { 'exact': '= %s', 'iexact': 'LIKE %s', Modified: django/branches/magic-removal/django/db/backends/dummy/base.py =================================================================== --- django/branches/magic-removal/django/db/backends/dummy/base.py 2006-04-23 21:30:04 UTC (rev 2731) +++ django/branches/magic-removal/django/db/backends/dummy/base.py 2006-04-23 21:45:36 UTC (rev 2732) @@ -33,4 +33,5 @@ get_date_trunc_sql = complain get_limit_offset_sql = complain get_random_function_sql = complain +get_drop_foreignkey_sql = complain OPERATOR_MAPPING = {} Modified: django/branches/magic-removal/django/db/backends/mysql/base.py =================================================================== --- django/branches/magic-removal/django/db/backends/mysql/base.py 2006-04-23 21:30:04 UTC (rev 2731) +++ django/branches/magic-removal/django/db/backends/mysql/base.py 2006-04-23 21:45:36 UTC (rev 2732) @@ -146,6 +146,9 @@ def get_random_function_sql(): return "RAND()" +def get_drop_foreignkey_sql(): + return "DROP FOREIGN KEY" + OPERATOR_MAPPING = { 'exact': '= %s', 'iexact': 'LIKE %s', Modified: django/branches/magic-removal/django/db/backends/postgresql/base.py =================================================================== --- django/branches/magic-removal/django/db/backends/postgresql/base.py 2006-04-23 21:30:04 UTC (rev 2731) +++ django/branches/magic-removal/django/db/backends/postgresql/base.py 2006-04-23 21:45:36 UTC (rev 2732) @@ -98,6 +98,9 @@ def get_random_function_sql(): return "RANDOM()" +def get_drop_foreignkey_sql(): + return "DROP CONSTRAINT" + # Register these custom typecasts, because Django expects dates/times to be # in Python's native (standard-library) datetime/time format, whereas psycopg # use mx.DateTime by default. Modified: django/branches/magic-removal/django/db/backends/sqlite3/base.py =================================================================== --- django/branches/magic-removal/django/db/backends/sqlite3/base.py 2006-04-23 21:30:04 UTC (rev 2731) +++ django/branches/magic-removal/django/db/backends/sqlite3/base.py 2006-04-23 21:45:36 UTC (rev 2732) @@ -116,6 +116,9 @@ def get_random_function_sql(): return "RANDOM()" +def get_drop_foreignkey_sql(): + return "" + def _sqlite_date_trunc(lookup_type, dt): try: dt = util.typecast_timestamp(dt) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-updates -~----------~----~----~----~------~----~------~--~---