Commits

Hynek Cernoch  committed ebf9887 Draft

Fixed upgrade: Skipping initial migration if the table exists.

  • Participants
  • Parent commits 2100aeb

Comments (0)

Files changed (1)

File livesettings/migrations/0001_initial.py

 
     def forwards(self, orm):
         
+        try:
+            from django.db import connection
+            cursor = connection.cursor()
+            table_names = []
+            if cursor:
+                table_names = connection.introspection.get_table_list(cursor)
+                if 'livesettings_longsetting' in table_names:
+                    return
+        except Exception, e:
+            raise Exception("unable to determine if the table 'shop_downloadlink' exists, %s" % e)
+
         # Adding model 'Setting'
         db.create_table('livesettings_setting', (
             ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),