Master/slave relationships

At present, master/slave relationships in FreshPorts are not stored optimally. Each port has a field, master_port, which contains the category/port of its master_port, otherwise, it is an empty string.

The ideal situation would be a table such as this:

create table master_slave
(
    master_port_id  integer               not null,
    slave_port_id   integer               not null,
    primary key (master_port_id, slave_port_id)
);

alter table master_slave
    add foreign key  (master_port_id)
       references ports (id) on update cascade on delete cascade;

alter table master_slave
    add foreign key  (slave_port_id)
       references ports (id) on update cascade on delete cascade;

This would allow me to easiliy create triggers to clear the cache for both master and slave ports. It is also the right structure to use. I think I’ve run out of time to do this today.

Website Pin Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google StumbleUpon Premium Responsive

Leave a Comment

Scroll to Top