Update of /cvsroot/sqlobject/SQLObject/SQLObject
In directory sc8-pr-cvs1:/tmp/cvs-serv18414/SQLObject
Modified Files:
Col.py
Log Message:
* Made the EnumCol use Postgres' constraints
* Small Enum test
* Made alternateID imply unique
Index: Col.py
===================================================================
RCS file: /cvsroot/sqlobject/SQLObject/SQLObject/Col.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** Col.py 19 Apr 2003 00:06:04 -0000 1.11
--- Col.py 19 Apr 2003 00:54:25 -0000 1.12
***************
*** 114,118 ****
if self.notNull:
result.append('NOT NULL')
! if self.unique:
result.append('UNIQUE')
return result
--- 114,118 ----
if self.notNull:
result.append('NOT NULL')
! if self.unique or self.alternateID:
result.append('UNIQUE')
return result
***************
*** 206,210 ****
def _postgresType(self):
- # @@: there's a better type for this...
return 'INT'
--- 206,209 ----
***************
*** 225,230 ****
def _postgresType(self):
length = max(map(len, self.enumValues))
! # 3-03 @@: should this be CHAR?
! return "VARCHAR(%i)" % length
def _sqliteType(self):
--- 224,230 ----
def _postgresType(self):
length = max(map(len, self.enumValues))
! enumValues = ', '.join(map(SQLBuilder.sqlRepr, self.enumValues))
! checkConstraint = "CHECK (%s in (%s))" % (self.dbName, enumValues)
! return "VARCHAR(%i) %s" % (length, checkConstraint)
def _sqliteType(self):
|