@@ -56,8 +56,9 @@ def __init__(self,dbConnection):
5656 def creationFieldsStr ():
5757 outStr = ''
5858 for fieldName ,fieldValue in self ._entFields .items ():
59- outStr = + '%s %s,' % (str (fieldName ),str (fieldValue ))
60- return outStr
59+ outStr += '%s %s,' % (str (fieldName ),str (fieldValue ))
60+ return outStr [:- 1 ]
61+
6162 def addTableField (fieldName ,fieldType ):
6263 sql = "ALTER TABLE pycadent ADD COLUMN %s %s " % (str (fieldName ),str (fieldType ))
6364 self .makeUpdateInsert (sql )
@@ -71,16 +72,16 @@ def addTableField(fieldName,fieldType):
7172 if _table is None :
7273 _sqlCreation = """CREATE TABLE pycadent(
7374 %s)""" % creationFieldsStr ()
75+ self .__revisionIndex = 0
76+ self .makeUpdateInsert (_sqlCreation )
7477 else :
7578 rows = self .makeSelect ("pragma table_info('pycadent')" )
7679 dbColumns = dict ([(row [1 ],row [2 ]) for row in rows ])
7780 for classColumn in self ._entFields .keys ():
7881 if not classColumn in dbColumns :
7982 addTableField (classColumn ,self ._entFields [classColumn ])
80-
81-
82- self .__revisionIndex = self .getRevisionIndex ()
83-
83+ self .__revisionIndex = self .getRevisionIndex ()
84+
8485 def getRevisionIndex (self ):
8586 """
8687 get the revision index from the database
0 commit comments