harmony: fix message_sends constraints
This commit is contained in:
parent
3b4d9723f4
commit
a206646975
@ -18,9 +18,24 @@ create table message_sends
|
|||||||
send_error text,
|
send_error text,
|
||||||
|
|
||||||
constraint message_sends_pk
|
constraint message_sends_pk
|
||||||
primary key (from_key, nonce)
|
primary key (send_task_id, from_key)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
comment on column message_sends.from_key is 'text f[1/3/4]... address';
|
||||||
|
comment on column message_sends.nonce is 'assigned message nonce';
|
||||||
|
comment on column message_sends.to_addr is 'text f[0/1/2/3/4]... address';
|
||||||
|
comment on column message_sends.signed_data is 'signed message data';
|
||||||
|
comment on column message_sends.signed_cid is 'signed message cid';
|
||||||
|
comment on column message_sends.send_reason is 'optional description of send reason';
|
||||||
|
comment on column message_sends.send_success is 'whether this message was broadcasted to the network already';
|
||||||
|
|
||||||
|
create unique index message_sends_success_index
|
||||||
|
on message_sends (from_key, nonce)
|
||||||
|
where send_success is not false;
|
||||||
|
|
||||||
|
comment on index message_sends_success_index is
|
||||||
|
'message_sends_success_index enforces sender/nonce uniqueness, it is a conditional index that only indexes rows where send_success is not false. This allows us to have multiple rows with the same sender/nonce, as long as only one of them was successfully broadcasted (true) to the network or is in the process of being broadcasted (null).';
|
||||||
|
|
||||||
create table message_send_locks
|
create table message_send_locks
|
||||||
(
|
(
|
||||||
from_key text not null,
|
from_key text not null,
|
||||||
@ -30,11 +45,3 @@ create table message_send_locks
|
|||||||
constraint message_send_locks_pk
|
constraint message_send_locks_pk
|
||||||
primary key (from_key)
|
primary key (from_key)
|
||||||
);
|
);
|
||||||
|
|
||||||
comment on column message_sends.from_key is 'text f[1/3/4]... address';
|
|
||||||
comment on column message_sends.nonce is 'assigned message nonce';
|
|
||||||
comment on column message_sends.to_addr is 'text f[0/1/2/3/4]... address';
|
|
||||||
comment on column message_sends.signed_data is 'signed message data';
|
|
||||||
comment on column message_sends.signed_cid is 'signed message cid';
|
|
||||||
comment on column message_sends.send_reason is 'optional description of send reason';
|
|
||||||
comment on column message_sends.send_success is 'whether this message was broadcasted to the network already';
|
|
||||||
|
Loading…
Reference in New Issue
Block a user