Commits

adamv  committed 8a94437

Test and fix for issue 35 - constraints created for Positive[Small]Integer fields should now be unique.

  • Participants
  • Parent commits f004e3a

Comments (0)

Files changed (3)

File source/sqlserver_ado/creation.py

         'IPAddressField':    'nvarchar(15)',
         'NullBooleanField':  'bit',
         'OneToOneField':     'int',
-        'PositiveIntegerField': 'int CONSTRAINT [CK_int_pos_%(column)s] CHECK ([%(column)s] >= 0)',
-        'PositiveSmallIntegerField': 'smallint CONSTRAINT [CK_smallint_pos_%(column)s] CHECK ([%(column)s] >= 0)',
+        'PositiveIntegerField': 
+                'int CONSTRAINT [CK_int_pos_%(column)s_%(creation_counter)s] CHECK ([%(column)s] >= 0)',
+        'PositiveSmallIntegerField': 
+                'smallint CONSTRAINT [CK_smallint_pos_%(column)s_%(creation_counter)s] CHECK ([%(column)s] >= 0)',
         'SlugField':         'nvarchar(%(max_length)s)',
         'SmallIntegerField': 'smallint',
         'TextField':         'nvarchar(max)',

File tests/test_main/apitest/tests.py

 
     def help_nextset_tearDown(self,cur):
         pass
+        
+    def test_ExceptionsAsConnectionAttributes(self):
+        pass

File tests/test_main/regressiontests/models.py

     0
     """
     posted = models.DateField()
+
+class Bug35ATable(models.Model):
+    """Ensure that multiple Postive Integer columns across tables don't 
+    create duplicate constraint names.
+    """
+    int1 = models.PositiveIntegerField()
+    int2 = models.PositiveIntegerField()
+    int3 = models.PositiveSmallIntegerField()
+    int4 = models.PositiveSmallIntegerField()
+
+class Bug35BTable(models.Model):
+    """Ensure that multiple Postive Integer columns across tables don't 
+    create duplicate constraint names.
+    """
+    int1 = models.PositiveIntegerField()
+    int2 = models.PositiveIntegerField()
+    int3 = models.PositiveSmallIntegerField()
+    int4 = models.PositiveSmallIntegerField()