Skip to content

Commit 4c5c55c

Browse files
committed
Fix UUID space error
1 parent ce6cf76 commit 4c5c55c

File tree

5 files changed

+27
-2
lines changed

5 files changed

+27
-2
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
setup(
1919
name='django-mssql-backend',
20-
version='2.4.0',
20+
version='2.4.1',
2121
description='Django backend for Microsoft SQL Server',
2222
long_description=open('README.rst').read(),
2323
author='ES Solutions AB',

sql_server/pyodbc/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class DatabaseWrapper(BaseDatabaseWrapper):
9797
'SmallIntegerField': 'smallint',
9898
'TextField': 'nvarchar(max)',
9999
'TimeField': 'time',
100-
'UUIDField': 'char(32)',
100+
'UUIDField': 'char(36)',
101101
}
102102
data_type_check_constraints = {
103103
'PositiveIntegerField': '[%(column)s] >= 0',

testapp/migrations/0001_initial.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Generated by Django 2.2.8.dev20191112211527 on 2019-11-15 01:38
22

3+
import uuid
4+
35
from django.db import migrations, models
46
import django
57

@@ -28,4 +30,10 @@ class Migration(migrations.Migration):
2830
('created_at', models.DateTimeField(default=django.utils.timezone.now)),
2931
],
3032
),
33+
migrations.CreateModel(
34+
name='UUIDModel',
35+
fields=[
36+
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
37+
],
38+
),
3139
]

testapp/models.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import uuid
2+
13
from django.db import models
24
from django.utils import timezone
35

@@ -16,3 +18,10 @@ class Comment(models.Model):
1618

1719
def __str__(self):
1820
return self.text
21+
22+
23+
class UUIDModel(models.Model):
24+
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
25+
26+
def __str__(self):
27+
return self.pk

testapp/tests/test_fields.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from django.test import TestCase
2+
3+
from ..models import UUIDModel
4+
5+
6+
class TestUUIDField(TestCase):
7+
def test_create(self):
8+
UUIDModel.objects.create()

0 commit comments

Comments
 (0)