# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


def create_shipping_event(apps, schema_editor):
    """

    Create a single new shipping event type that can be applied to an order. This will allow us to initiate order
    shipment.

    """
    # Create all our Product Types.
    ShippingEventType = apps.get_model("order", "ShippingEventType")
    shipped_event = ShippingEventType(code="shipped", name="Shipped")
    shipped_event.save()


class Migration(migrations.Migration):

    dependencies = [
        ('order', '0002_auto_20141007_2032'),
    ]

    operations = [
        migrations.RunPython(create_shipping_event),
    ]

ecommerce/extensions/order/migrations/0003_auto_20150224_1520.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


def create_shipping_event(apps, schema_editor):
    """

    Create a single new shipping event type that can be applied to an order. This will allow us to initiate order
    shipment.

    """
    # Create all our Product Types.
    ShippingEventType = apps.get_model("order", "ShippingEventType")
    ShippingEventType.objects.create(code="shipped", name="Shipped")


class Migration(migrations.Migration):

    dependencies = [
        ('order', '0002_auto_20141007_2032'),
    ]

    operations = [
        migrations.RunPython(create_shipping_event),
    ]

ecommerce/extensions/order/migrations/0003_auto_20150224_1520.py
diff --git a/Makefile b/Makefile
index 15be88d0c1d..cc16c6d8e2e 100644
--- a/Makefile
+++ b/Makefile
@@ -50,14 +50,14 @@ validate_js:
 
 validate_python: clean
 	python manage.py compress --settings=ecommerce.settings.test -v0
-	DISABLE_MIGRATIONS=True coverage run --branch --source=ecommerce ./manage.py test ecommerce \
+	REUSE_DB=1 coverage run --branch --source=ecommerce ./manage.py test ecommerce \
 	--settings=ecommerce.settings.test --with-ignore-docstrings --logging-level=DEBUG
 	coverage report
 	make quality
 
 fast_validate_python: clean
 	python manage.py compress --settings=ecommerce.settings.test -v0
-	DISABLE_MIGRATIONS=True DISABLE_ACCEPTANCE_TESTS=True ./manage.py test ecommerce \
+	REUSE_DB=1 DISABLE_ACCEPTANCE_TESTS=True ./manage.py test ecommerce \
 	--settings=ecommerce.settings.test --processes=4 --with-ignore-docstrings --logging-level=DEBUG
 	make quality
 
diff --git a/ecommerce/extensions/order/migrations/0003_auto_20150224_1520.py b/ecommerce/extensions/order/migrations/0003_auto_20150224_1520.py
index 13bae5a2939..eb7599de951 100644
--- a/ecommerce/extensions/order/migrations/0003_auto_20150224_1520.py
+++ b/ecommerce/extensions/order/migrations/0003_auto_20150224_1520.py
@@ -13,8 +13,7 @@ def create_shipping_event(apps, schema_editor):
     """
     # Create all our Product Types.
     ShippingEventType = apps.get_model("order", "ShippingEventType")
-    shipped_event = ShippingEventType(code="shipped", name="Shipped")
-    shipped_event.save()
+    ShippingEventType.objects.create(code="shipped", name="Shipped")
 
 
 class Migration(migrations.Migration):
diff --git a/ecommerce/extensions/order/tests/test_processing.py b/ecommerce/extensions/order/tests/test_processing.py
index 2432d4bc9f7..83d4326e049 100644
--- a/ecommerce/extensions/order/tests/test_processing.py
+++ b/ecommerce/extensions/order/tests/test_processing.py
@@ -15,7 +15,7 @@ class EventHandlerTests(TestCase):
 
     def setUp(self):
         super(EventHandlerTests, self).setUp()
-        self.shipping_event_type = ShippingEventType.objects.create(name=SHIPPING_EVENT_NAME)
+        self.shipping_event_type, __ = ShippingEventType.objects.get_or_create(name=SHIPPING_EVENT_NAME)
         self.order = factories.create_order()
 
     def test_create_shipping_event_all_lines_complete(self):
diff --git a/ecommerce/settings/test.py b/ecommerce/settings/test.py
index 3513f94af13..2c857bc49d0 100644
--- a/ecommerce/settings/test.py
+++ b/ecommerce/settings/test.py
@@ -13,34 +13,6 @@
 TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
 
 LOGGING = get_logger_config(debug=DEBUG, dev_env=True, local_loglevel='DEBUG')
-
-
-class DisableMigrations(object):
-    """Override method calls on the MIGRATION_MODULES dictionary.
-
-    If the `makemigrations` command has not been run for an app, the
-    `migrate` command treats that app as unmigrated, creating tables
-    directly from the models just like the now-defunct `syncdb` command
-    used to do. These overrides are used to force Django to treat apps
-    in this project as unmigrated.
-
-    Django 1.8 features the `--keepdb` flag for exactly this purpose,
-    but we don't have that luxury in 1.7.
-
-    For more context, see http://goo.gl/Fr4qyE.
-    """
-
-    def __contains__(self, item):
-        """Make it appear as if all apps are contained in the dictionary."""
-        return True
-
-    def __getitem__(self, item):
-        """Force Django to look for migrations in a nonexistent package."""
-        return 'notmigrations'
-
-
-if str(os.environ.get('DISABLE_MIGRATIONS')) == 'True':
-    MIGRATION_MODULES = DisableMigrations()
 # END TEST SETTINGS
 
 

Running migrations for Travis builds
We run migrations to ensure no migrations are missing, and they work on fresh installs.

