machine_access_table = Table('machine_access', meta,
Column('machine_id', Integer, ForeignKey('machines.machine_id'), nullable=False, index=True),
Column('user', String, nullable=False, index=True),
- PrimaryKeyConstraint('machine_id', 'user'))
+ PrimaryKeyConstraint('machine_id', 'user', ondelete='CASCADE'))
class Machine(object):
def __repr__(self):
properties={'nics': relation(NIC, backref="machine", lazy=False),
'disks': relation(Disk, backref="machine", lazy=False),
'type': relation(Type, lazy=False),
- 'acl': relation(MachineAccess, backref="machine", lazy=False, private=True)});
+ 'acl': relation(MachineAccess, backref="machine", lazy=False, passive_deletes=True, cascade="all, delete-orphan")});
assign_mapper(ctx, MachineAccess, machine_access_table)
assign_mapper(ctx, NIC, nic_table)
assign_mapper(ctx, Disk, disk_table)