1
0
mirror of https://github.com/django/django.git synced 2025-10-25 06:36:07 +00:00

Fixed #33057 -- Fixed recreation of foreign key constraints in m2m tables when altering type of referenced primary key on Oracle.

This commit is contained in:
Mariusz Felisiak
2021-08-31 13:43:10 +02:00
committed by GitHub
parent b667ac24ea
commit 1eb3f500a4
2 changed files with 36 additions and 1 deletions

View File

@@ -1500,10 +1500,32 @@ class OperationTests(OperationTestBase):
with connection.schema_editor() as editor:
operation.database_forwards("test_alflpkfk", editor, project_state, new_state)
assertIdTypeEqualsFkType()
if connection.features.supports_foreign_keys:
self.assertFKExists(
'test_alflpkfk_pony_stables',
['pony_id'],
('test_alflpkfk_pony', 'id'),
)
self.assertFKExists(
'test_alflpkfk_stable_ponies',
['pony_id'],
('test_alflpkfk_pony', 'id'),
)
# And test reversal
with connection.schema_editor() as editor:
operation.database_backwards("test_alflpkfk", editor, new_state, project_state)
assertIdTypeEqualsFkType()
if connection.features.supports_foreign_keys:
self.assertFKExists(
'test_alflpkfk_pony_stables',
['pony_id'],
('test_alflpkfk_pony', 'id'),
)
self.assertFKExists(
'test_alflpkfk_stable_ponies',
['pony_id'],
('test_alflpkfk_pony', 'id'),
)
def test_alter_field_pk_mti_fk(self):
app_label = 'test_alflpkmtifk'