Rewrote contact_known_keys structure

This commit is contained in:
netkas 2025-01-27 15:28:41 -05:00
parent a05b02da71
commit e38ebf277a

View file

@ -1,20 +1,22 @@
create table contacts_known_keys create table contacts_known_keys
( (
contact_uuid varchar(36) not null comment 'The UUID of the contact in reference to', contact_uuid varchar(36) not null comment 'The Unique Universal Identifier of the personal contact that this record is associated with',
key_name varchar(64) not null comment 'The name of the key', signature_uuid varchar(36) not null comment 'The Unique Universal Identifier for the signature key',
public_key varchar(64) not null comment 'The public signing key', signature_name varchar(64) not null comment 'The name of the signing key',
expires timestamp not null comment 'The Timestamp for when this key expires', signature_key varchar(32) not null comment 'The public signing key',
trusted_at timestamp default current_timestamp() not null comment 'The Timestamp for when this signing key was trusted', expires timestamp null comment 'The Timestamp for when this key expires, null means never',
primary key (contact_uuid, key_name) comment 'The unique key-name pair with the contact uuid to ensure no keys with the same names should exist', created timestamp not null comment 'The Timestamp for when this key was created',
constraint contacts_known_keys_contact_uuid_key_name_uindex trusted_on timestamp default current_timestamp() not null comment 'The Timestamp for when the peer trusted this key',
unique (contact_uuid, key_name) comment 'The unique key-name pair with the contact uuid to ensure no keys with the same names should exist', primary key (contact_uuid, signature_uuid),
constraint contacts_known_keys_signature_uuid_contact_uuid_uindex
unique (signature_uuid, contact_uuid) comment 'The Unique Signature Index Pair for the contact UUID and key UUID',
constraint contacts_known_keys_contacts_uuid_fk constraint contacts_known_keys_contacts_uuid_fk
foreign key (contact_uuid) references contacts (uuid) foreign key (contact_uuid) references contacts (uuid)
on update cascade on delete cascade on update cascade on delete cascade
) )
comment 'Table for housing known signing keys for peer contacts'; comment 'Table for housing known keys associated with personal contact records';
create index contacts_known_keys_key_name_index create index contacts_known_keys_contact_uuid_index
on contacts_known_keys (key_name) on contacts_known_keys (contact_uuid)
comment 'The index for the key name'; comment 'The Index of the contact UUID';