Ticket #23030: spatialite_migrations_regression.patch
File spatialite_migrations_regression.patch, 2.7 KB (added by , 10 years ago) |
---|
-
django/contrib/gis/tests/gis_migrations/migrations/0001_initial.py
a b 1 1 from django.db import models, migrations 2 2 import django.contrib.gis.db.models.fields 3 3 4 5 4 # Used for regression test of ticket #22001: https://code.djangoproject.com/ticket/22001 5 # Also used for regression test of ticket #23030: https://code.djangoproject.com/ticket/23030 6 6 class Migration(migrations.Migration): 7 7 8 8 operations = [ … … 29 29 options={ 30 30 }, 31 31 bases=(models.Model,), 32 ) 32 ), 33 migrations.CreateModel( 34 name='Family', 35 fields=[ 36 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), 37 ('name', models.CharField(max_length=100, unique=True)), 38 ], 39 options={ 40 }, 41 bases=(models.Model,), 42 ), 43 migrations.AddField( 44 model_name='household', 45 name='family', 46 field=models.ForeignKey(blank=True, to='gis.Family', null=True), 47 preserve_default=True, 48 ), 33 49 ] -
django/contrib/gis/tests/gis_migrations/test_commands.py
a b 34 34 Tests basic usage of the migrate command when a model uses Geodjango 35 35 fields. Regression test for ticket #22001: 36 36 https://code.djangoproject.com/ticket/22001 37 38 It's also used to showcase an error in migrations where spatialite is 39 enabled and geo tables are renamed resulting in unique constraint 40 failure on geometry_columns. Regression for ticket #23030: 41 https://code.djangoproject.com/ticket/23030 37 42 """ 38 43 # Make sure no tables are created 39 44 self.assertTableNotExists("migrations_neighborhood") 40 45 self.assertTableNotExists("migrations_household") 46 self.assertTableNotExists("migrations_family") 41 47 # Run the migrations to 0001 only 42 48 call_command("migrate", "gis", "0001", verbosity=0) 43 49 # Make sure the right tables exist 44 50 self.assertTableExists("gis_neighborhood") 45 51 self.assertTableExists("gis_household") 52 self.assertTableExists("gis_family") 46 53 # Unmigrate everything 47 54 call_command("migrate", "gis", "zero", verbosity=0) 48 55 # Make sure it's all gone 49 56 self.assertTableNotExists("gis_neighborhood") 50 57 self.assertTableNotExists("gis_household") 58 self.assertTableNotExists("gis_family")