create table peers_associations ( child_peer varchar(255) not null comment 'The peer that is used to declare the association to the parent peer', parent_peer varchar(255) not null comment 'The parent peer that the child peer is associated with', association_type tinytext not null comment 'The association type between the child peer and the parent peer', client_uuid varchar(36) not null comment 'The client UUID that made the association between the two peers', timestamp int default unix_timestamp() not null comment 'The Unix Timestamp for when the client made the association', constraint peers_associations_child_peer_parent_peer_uindex unique (child_peer, parent_peer), constraint peers_associations_clients_uuid_fk foreign key (client_uuid) references clients (uuid), constraint peers_associations_peers_federated_address_fk foreign key (child_peer) references peers (federated_address), constraint peers_associations_peers_federated_address_fk2 foreign key (parent_peer) references peers (federated_address) );