1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Fixed #22293 -- Avoided renaming many-to-many tables to themselves.

Fixed this for both implementations of _alter_many_to_many, instead of
in `alter_db_table` itself (more implementations).
This commit is contained in:
Daniel Hahler
2014-03-20 05:08:28 +01:00
committed by Tim Graham
parent d81a9c50d8
commit 1edfa155e3
3 changed files with 14 additions and 1 deletions

View File

@@ -347,6 +347,15 @@ class SchemaTests(TransactionTestCase):
# Ensure there is now an m2m table there
columns = self.column_classes(new_field.rel.through)
self.assertEqual(columns['tagm2mtest_id'][0], "IntegerField")
# "Alter" the field. This should not rename the DB table to itself.
with connection.schema_editor() as editor:
editor.alter_field(
Author,
new_field,
new_field,
)
# Remove the M2M table again
with connection.schema_editor() as editor:
editor.remove_field(