--- a/django/contrib/gis/tests/gis_migrations/migrations/0001_initial.py	2014-07-15 11:43:14.000000000 +0200
+++ b/django/contrib/gis/tests/gis_migrations/migrations/0001_initial.py	2014-07-15 16:46:05.005662227 +0200
@@ -1,8 +1,8 @@
 from django.db import models, migrations
 import django.contrib.gis.db.models.fields
 
-
 # Used for regression test of ticket #22001: https://code.djangoproject.com/ticket/22001
+# Also used for regression test of ticket #23030: https://code.djangoproject.com/ticket/23030
 class Migration(migrations.Migration):
 
     operations = [
@@ -29,5 +29,21 @@
             options={
             },
             bases=(models.Model,),
-        )
+        ),
+        migrations.CreateModel(
+            name='Family',
+            fields=[
+                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+                ('name', models.CharField(max_length=100, unique=True)),
+            ],
+            options={
+            },
+            bases=(models.Model,),
+        ),
+        migrations.AddField(
+            model_name='household',
+            name='family',
+            field=models.ForeignKey(blank=True, to='gis.Family', null=True),
+            preserve_default=True,
+        ),        
     ]

--- a/django/contrib/gis/tests/gis_migrations/test_commands.py	2014-07-15 11:43:14.000000000 +0200
+++ b/django/contrib/gis/tests/gis_migrations/test_commands.py	2014-07-15 16:47:48.092665525 +0200
@@ -34,17 +34,25 @@
         Tests basic usage of the migrate command when a model uses Geodjango
         fields. Regression test for ticket #22001:
         https://code.djangoproject.com/ticket/22001
+        
+        It's also used to showcase an error in migrations where spatialite is
+        enabled and geo tables are renamed resulting in unique constraint
+        failure on geometry_columns. Regression for ticket #23030:
+        https://code.djangoproject.com/ticket/23030
         """
         # Make sure no tables are created
         self.assertTableNotExists("migrations_neighborhood")
         self.assertTableNotExists("migrations_household")
+        self.assertTableNotExists("migrations_family")
         # Run the migrations to 0001 only
         call_command("migrate", "gis", "0001", verbosity=0)
         # Make sure the right tables exist
         self.assertTableExists("gis_neighborhood")
         self.assertTableExists("gis_household")
+        self.assertTableExists("gis_family")
         # Unmigrate everything
         call_command("migrate", "gis", "zero", verbosity=0)
         # Make sure it's all gone
         self.assertTableNotExists("gis_neighborhood")
         self.assertTableNotExists("gis_household")
+        self.assertTableNotExists("gis_family")
