summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/databases/mssql.py
diff options
context:
space:
mode:
authorMichael Trier <mtrier@gmail.com>2008-12-28 07:40:56 +0000
committerMichael Trier <mtrier@gmail.com>2008-12-28 07:40:56 +0000
commitcae83f6d4fc3eef57814e6bd554bc39461644359 (patch)
tree6fa7468f27e727b43e6d5eeaf9080363e0639af1 /lib/sqlalchemy/databases/mssql.py
parentdefba2fc020556dadd106e7e4e35907216d9208d (diff)
downloadsqlalchemy-cae83f6d4fc3eef57814e6bd554bc39461644359.tar.gz
On MSSQL if a field is part of the primary_key then it should not allow NULLS.
Diffstat (limited to 'lib/sqlalchemy/databases/mssql.py')
-rw-r--r--lib/sqlalchemy/databases/mssql.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/sqlalchemy/databases/mssql.py b/lib/sqlalchemy/databases/mssql.py
index 777c86d40..61f54a8ba 100644
--- a/lib/sqlalchemy/databases/mssql.py
+++ b/lib/sqlalchemy/databases/mssql.py
@@ -1499,7 +1499,7 @@ class MSSQLSchemaGenerator(compiler.SchemaGenerator):
colspec = self.preparer.format_column(column) + " " + column.type.dialect_impl(self.dialect).get_col_spec()
if column.nullable is not None:
- if not column.nullable:
+ if not column.nullable or column.primary_key:
colspec += " NOT NULL"
else:
colspec += " NULL"