Ticket #1373: fix_drop_foreignkey.diff
File fix_drop_foreignkey.diff, 2.8 KB (added by , 19 years ago) |
---|
-
db/backends/ado_mssql/base.py
114 114 def get_random_function_sql(): 115 115 return "RAND()" 116 116 117 def get_foreignkey_drop(table, name): 118 return "ALTER TABLE %s DROP CONSTRAINT %s;" % \ 119 (quote_name(table),quote_name(name)) 120 117 121 OPERATOR_MAPPING = { 118 122 'exact': '= %s', 119 123 'iexact': 'LIKE %s', -
db/backends/postgresql/base.py
91 91 def get_random_function_sql(): 92 92 return "RANDOM()" 93 93 94 def get_foreignkey_drop(table, name): 95 return "ALTER TABLE %s DROP CONSTRAINT %s;" % \ 96 (quote_name(table),quote_name(name)) 97 94 98 # Register these custom typecasts, because Django expects dates/times to be 95 99 # in Python's native (standard-library) datetime/time format, whereas psycopg 96 100 # use mx.DateTime by default. -
db/backends/sqlite3/base.py
110 110 def get_random_function_sql(): 111 111 return "RANDOM()" 112 112 113 def get_foreignkey_drop(table, name): 114 return "" 115 113 116 def _sqlite_date_trunc(lookup_type, dt): 114 117 try: 115 118 dt = util.typecast_timestamp(dt) -
db/backends/mysql/base.py
130 130 def get_random_function_sql(): 131 131 return "RAND()" 132 132 133 def get_foreignkey_drop(table, name): 134 return "ALTER TABLE %s DROP FOREIGN KEY %s;" % \ 135 (quote_name(table),quote_name(name)) 136 133 137 OPERATOR_MAPPING = { 134 138 'exact': '= %s', 135 139 'iexact': 'LIKE %s', -
core/management.py
252 252 col = f.column 253 253 r_table = klass._meta.db_table 254 254 r_col = klass._meta.get_field(f.rel.field_name).column 255 output.append('ALTER TABLE %s DROP CONSTRAINT %s;' % \ 256 (backend.quote_name(table), 257 backend.quote_name("%s_referencing_%s_%s" % (col, r_table, r_col)))) 255 output.append(backend.get_foreignkey_drop(table, 256 "%s_referencing_%s_%s" % (col, r_table, r_col))) 258 257 del references_to_delete[klass] 259 258 260 259 # Output DROP TABLE statements for many-to-many tables.