hooks/syncschema.py
changeset 10035 c5bcdece77fb
parent 9888 5b48dcc02be1
child 10074 ab956b780d4e
child 10585 80236876ee4d
equal deleted inserted replaced
10034:7d0acf9cb92a 10035:c5bcdece77fb
   447         column = SQL_PREFIX + rdefdef.name
   447         column = SQL_PREFIX + rdefdef.name
   448         try:
   448         try:
   449             cnx.system_sql(str('ALTER TABLE %s ADD %s %s'
   449             cnx.system_sql(str('ALTER TABLE %s ADD %s %s'
   450                                    % (table, column, attrtype)),
   450                                    % (table, column, attrtype)),
   451                                rollback_on_failure=False)
   451                                rollback_on_failure=False)
   452             self.info('added column %s to table %s', table, column)
   452             self.info('added column %s to table %s', column, table)
   453         except Exception as ex:
   453         except Exception as ex:
   454             # the column probably already exists. this occurs when
   454             # the column probably already exists. this occurs when
   455             # the entity's type has just been added or if the column
   455             # the entity's type has just been added or if the column
   456             # has not been previously dropped
   456             # has not been previously dropped
   457             self.error('error while altering table %s: %s', table, ex)
   457             self.error('error while altering table %s: %s', table, ex)