Commits

Stephan Jaensch committed 5f02953

- Handle NOT NULL to NULL migrations correctly when altering columns
- Bugfix: catch the correct exception

  • Participants
  • Parent commits 772c108

Comments (0)

Files changed (1)

south/db/oracle.py

 from django.core.management.color import no_style
 from django.db.backends.oracle.base import get_sequence_name
 from django.db.models.fields import NOT_PROVIDED
+from django.db.utils import DatabaseError
 from south.db import generic
 
 print >> sys.stderr, " ! WARNING: South's Oracle support is still alpha."
             'default': 'NULL'
         }
         if field.null:
-            params['nullity'] = ''
+            params['nullity'] = 'NULL'
         sqls = [self.alter_string_set_type % params]
 
         if not field.null and field.has_default():
         for sql in sqls:
             try:
                 self.execute(sql)
-            except cx_Oracle.DatabaseError, exc:
-                if str(exc).find('ORA-01442') == -1:
+            except DatabaseError, exc:
+                # Oracle complains if a column is already NULL/NOT NULL 
+                if str(exc).find('ORA-01442') == -1 and str(exc).find('ORA-01451') == -1:
                     raise
 
     @generic.copy_column_constraints