Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Refactored get_drop_foreignkey_sql() to DatabaseOperations.drop_forei…

…gnkey_sql(). Refs #5106

git-svn-id: http://code.djangoproject.com/svn/django/trunk@5956 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 23a736dca9b2a631e841a9daff067558206e7965 1 parent 8e84d35
@adrianholovaty adrianholovaty authored
View
2  django/core/management/sql.py
@@ -147,7 +147,7 @@ def sql_delete(app, style):
output.append('%s %s %s %s;' % \
(style.SQL_KEYWORD('ALTER TABLE'),
style.SQL_TABLE(backend.quote_name(table)),
- style.SQL_KEYWORD(backend.get_drop_foreignkey_sql()),
+ style.SQL_KEYWORD(connection.ops.drop_foreignkey_sql()),
style.SQL_FIELD(truncate_name(r_name, backend.get_max_name_length()))))
del references_to_delete[model]
if model._meta.has_auto_field and hasattr(backend, 'get_drop_sequence'):
View
6 django/db/backends/__init__.py
@@ -85,3 +85,9 @@ def deferrable_sql(self):
during a CREATE TABLE statement.
"""
return ''
+
+ def drop_foreignkey_sql(self):
+ """
+ Returns the SQL command that drops a foreign key.
+ """
+ return "DROP CONSTRAINT"
View
3  django/db/backends/ado_mssql/base.py
@@ -113,9 +113,6 @@ def get_random_function_sql():
def get_fulltext_search_sql(field_name):
raise NotImplementedError
-def get_drop_foreignkey_sql():
- return "DROP CONSTRAINT"
-
def get_pk_default_value():
return "DEFAULT"
View
1  django/db/backends/dummy/base.py
@@ -47,7 +47,6 @@ def close(self):
get_limit_offset_sql = complain
get_random_function_sql = complain
get_fulltext_search_sql = complain
-get_drop_foreignkey_sql = complain
get_pk_default_value = complain
get_max_name_length = ignore
get_start_transaction_sql = complain
View
6 django/db/backends/mysql/base.py
@@ -71,6 +71,9 @@ def date_trunc_sql(self, lookup_type, field_name):
sql = "CAST(DATE_FORMAT(%s, '%s') AS DATETIME)" % (field_name, format_str)
return sql
+ def drop_foreignkey_sql(self):
+ return "DROP FOREIGN KEY"
+
class DatabaseWrapper(BaseDatabaseWrapper):
ops = DatabaseOperations()
@@ -164,9 +167,6 @@ def get_random_function_sql():
def get_fulltext_search_sql(field_name):
return 'MATCH (%s) AGAINST (%%s IN BOOLEAN MODE)' % field_name
-def get_drop_foreignkey_sql():
- return "DROP FOREIGN KEY"
-
def get_pk_default_value():
return "DEFAULT"
View
6 django/db/backends/mysql_old/base.py
@@ -81,6 +81,9 @@ def date_trunc_sql(self, lookup_type, field_name):
sql = "CAST(DATE_FORMAT(%s, '%s') AS DATETIME)" % (field_name, format_str)
return sql
+ def drop_foreignkey_sql(self):
+ return "DROP FOREIGN KEY"
+
class DatabaseWrapper(BaseDatabaseWrapper):
ops = DatabaseOperations()
@@ -183,9 +186,6 @@ def get_random_function_sql():
def get_fulltext_search_sql(field_name):
return 'MATCH (%s) AGAINST (%%s IN BOOLEAN MODE)' % field_name
-def get_drop_foreignkey_sql():
- return "DROP FOREIGN KEY"
-
def get_pk_default_value():
return "DEFAULT"
View
3  django/db/backends/oracle/base.py
@@ -189,9 +189,6 @@ def get_random_function_sql():
def get_fulltext_search_sql(field_name):
raise NotImplementedError
-def get_drop_foreignkey_sql():
- return "DROP CONSTRAINT"
-
def get_pk_default_value():
return "DEFAULT"
View
3  django/db/backends/postgresql/base.py
@@ -143,9 +143,6 @@ def get_random_function_sql():
def get_fulltext_search_sql(field_name):
raise NotImplementedError
-def get_drop_foreignkey_sql():
- return "DROP CONSTRAINT"
-
def get_pk_default_value():
return "DEFAULT"
View
3  django/db/backends/postgresql_psycopg2/base.py
@@ -97,9 +97,6 @@ def get_random_function_sql():
def get_fulltext_search_sql(field_name):
raise NotImplementedError
-def get_drop_foreignkey_sql():
- return "DROP CONSTRAINT"
-
def get_pk_default_value():
return "DEFAULT"
View
6 django/db/backends/sqlite3/base.py
@@ -45,6 +45,9 @@ def date_trunc_sql(self, lookup_type, field_name):
# function django_date_trunc that's registered in connect().
return 'django_date_trunc("%s", %s)' % (lookup_type.lower(), field_name)
+ def drop_foreignkey_sql(self):
+ return ""
+
class DatabaseWrapper(BaseDatabaseWrapper):
ops = DatabaseOperations()
@@ -127,9 +130,6 @@ def get_random_function_sql():
def get_fulltext_search_sql(field_name):
raise NotImplementedError
-def get_drop_foreignkey_sql():
- return ""
-
def get_pk_default_value():
return "NULL"
Please sign in to comment.
Something went wrong with that request. Please try again.