diff options
| author | Simon Charette <charette.s@gmail.com> | 2020-04-17 00:54:37 -0400 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-04-21 08:37:47 +0200 |
| commit | 5220ca8d8a109721378e8d4c7f32e342c3a83af6 (patch) | |
| tree | 07324cd54be61dc5a8cdbdf39801ee71591bc61a /tests | |
| parent | a54828085732d5d2f020c2fb52fe1cbe1a20a6c9 (diff) | |
Refs #30591 -- Adjusted table rebuild for non-pk relationship on SQLite.
The existing code was only accounting for primary key changes and not
all unique key fields that can be referenced.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/migrations/test_operations.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/migrations/test_operations.py b/tests/migrations/test_operations.py index 051b8036b5..bb4b74e727 100644 --- a/tests/migrations/test_operations.py +++ b/tests/migrations/test_operations.py @@ -1341,7 +1341,7 @@ class OperationTests(OperationTestBase): project_state = self.apply_operations(app_label, ProjectState(), operations=[ migrations.CreateModel('Rider', fields=[ ('id', models.AutoField(primary_key=True)), - ('code', models.PositiveIntegerField(unique=True)), + ('code', models.IntegerField(unique=True)), ]), migrations.CreateModel('Pony', fields=[ ('id', models.AutoField(primary_key=True)), @@ -1354,6 +1354,18 @@ class OperationTests(OperationTestBase): models.CharField(max_length=100, unique=True), ) self.apply_operations(app_label, project_state, operations=[operation]) + id_type, id_null = [ + (c.type_code, c.null_ok) + for c in self.get_table_description('%s_rider' % app_label) + if c.name == 'code' + ][0] + fk_type, fk_null = [ + (c.type_code, c.null_ok) + for c in self.get_table_description('%s_pony' % app_label) + if c.name == 'rider_id' + ][0] + self.assertEqual(id_type, fk_type) + self.assertEqual(id_null, fk_null) @skipUnlessDBFeature('supports_foreign_keys') def test_alter_field_reloads_state_on_fk_with_to_field_related_name_target_type_change(self): |
