29 lines
1.7 KiB
MySQL
29 lines
1.7 KiB
MySQL
|
create table restrictions
|
||
|
(
|
||
|
uuid varchar(36) default uuid() not null comment 'The Unique UUID V4 for the restriction record'
|
||
|
primary key,
|
||
|
peer varchar(256) not null comment 'The standard federated address of the peer',
|
||
|
client_uuid varchar(36) null comment 'Optional. The Client UUID that placed the restriction on the peer, if empty then it was an automated restriction placed by the system.',
|
||
|
reason varchar(64) not null comment 'The reason for the restriction that was applied to the peer',
|
||
|
automated tinyint default 0 not null comment 'Indicates if this restriction was automated',
|
||
|
type varchar(32) null comment 'The restriction type that was applied to the peer',
|
||
|
created bigint default unix_timestamp() not null comment 'The Unix Timestamp for when the restriction was created',
|
||
|
expires bigint not null comment 'The Unix Timestamp for when the restriction expires',
|
||
|
constraint restrictions_peer_uindex
|
||
|
unique (peer) comment 'The main unique index for the primary key "peer"',
|
||
|
constraint restrictions_uuid_uindex
|
||
|
unique (uuid),
|
||
|
constraint restrictions_clients_uuid_fk
|
||
|
foreign key (client_uuid) references clients (uuid),
|
||
|
constraint restrictions_peers_federated_address_fk
|
||
|
foreign key (peer) references peers (federated_address)
|
||
|
)
|
||
|
comment 'Archive of past restrictions placed on peers';
|
||
|
|
||
|
create index restrictions_automated_index
|
||
|
on restrictions (automated);
|
||
|
|
||
|
create index restrictions_client_uuid_index
|
||
|
on restrictions (client_uuid);
|
||
|
|