Mercurial > p > roundup > code
diff roundup/backends/rdbms_common.py @ 2728:572746c94537 maint-0.7
merge from HEAD
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Fri, 08 Oct 2004 00:21:31 +0000 |
| parents | 8140fb128088 |
| children | 0d8b3b5f40ea |
line wrap: on
line diff
--- a/roundup/backends/rdbms_common.py Thu Oct 07 23:14:23 2004 +0000 +++ b/roundup/backends/rdbms_common.py Fri Oct 08 00:21:31 2004 +0000 @@ -1,4 +1,4 @@ -# $Id: rdbms_common.py,v 1.98.2.20 2004-10-07 06:33:57 richard Exp $ +# $Id: rdbms_common.py,v 1.98.2.21 2004-10-08 00:21:31 richard Exp $ ''' Relational database (SQL) backend common code. Basics: @@ -403,12 +403,22 @@ if isinstance(prop, Multilink): self.create_multilink_table(spec, propname) else: - sql = 'alter table _%s add column _%s varchar(255)'%( - spec.classname, propname) + # add the column + coltype = self.hyperdb_to_sql_datatypes[prop.__class__] + sql = 'alter table _%s add column _%s %s'%( + spec.classname, propname, coltype) if __debug__: print >>hyperdb.DEBUG, 'update_class', (self, sql) self.cursor.execute(sql) + # extra Interval column + if isinstance(prop, Interval): + sql = 'alter table _%s add column __%s_int__ BIGINT'%( + spec.classname, propname) + if __debug__: + print >>hyperdb.DEBUG, 'update_class', (self, sql) + self.cursor.execute(sql) + # if the new column is a key prop, we need an index! if new_spec[0] == propname: self.create_class_table_key_index(spec.classname, propname)
