hooks/syncschema.py
changeset 10201 989bbadbcd8d
parent 10200 cceb2c7c02f4
child 10250 582301c2c8ca
equal deleted inserted replaced
10200:cceb2c7c02f4 10201:989bbadbcd8d
    70         return
    70         return
    71     createdattrs.add(attrkey)
    71     createdattrs.add(attrkey)
    72     table = SQL_PREFIX + etype
    72     table = SQL_PREFIX + etype
    73     column = SQL_PREFIX + rtype
    73     column = SQL_PREFIX + rtype
    74     try:
    74     try:
    75         cnx.system_sql(str('ALTER TABLE %s ADD %s integer' % (table, column)),
    75         cnx.system_sql(str('ALTER TABLE %s ADD %s integer REFERENCES entities (eid)' % (table, column)),
    76                        rollback_on_failure=False)
    76                        rollback_on_failure=False)
    77         cnx.info('added column %s to table %s', column, table)
    77         cnx.info('added column %s to table %s', column, table)
    78     except Exception:
    78     except Exception:
    79         # silent exception here, if this error has not been raised because the
    79         # silent exception here, if this error has not been raised because the
    80         # column already exists, index creation will fail anyway
    80         # column already exists, index creation will fail anyway