

def foreign_key_constraint(self, field):
    ddl = [SQL('FOREIGN KEY'), EnclosedClause(field.as_entity()), SQL('REFERENCES'), field.rel_model.as_entity(), EnclosedClause(field.to_field.as_entity())]
    if field.on_delete:
        ddl.append(SQL(('ON DELETE %s' % field.on_delete)))
    if field.on_update:
        ddl.append(SQL(('ON UPDATE %s' % field.on_update)))
    return Clause(*ddl)

dataset/ETHPy150Open coleifer/peewee/peewee.py QueryCompiler.foreign_key_constraint/original