feat: make the prover_task to unique

This commit is contained in:
georgehao
2023-08-21 17:42:51 +08:00
parent 0d847e0427
commit d2f2dae3de
9 changed files with 66 additions and 22 deletions

View File

@@ -4,7 +4,7 @@
create table prover_task
(
id BIGSERIAL PRIMARY KEY,
uuid VARCHAR NOT NULL,
-- prover
prover_public_key VARCHAR NOT NULL,
prover_name VARCHAR NOT NULL,
@@ -26,7 +26,7 @@ create table prover_task
updated_at TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP,
deleted_at TIMESTAMP(0) DEFAULT NULL,
CONSTRAINT uk_tasktype_taskid_publickey_version UNIQUE (task_type, task_id, prover_public_key, prover_version)
CONSTRAINT uk_uuid UNIQUE (uuid)
);
comment
@@ -38,6 +38,9 @@ on column prover_task.proving_status is 'undefined, prover assigned, prover proo
comment
on column prover_task.failure_type is 'undefined';
create index idx_uuid
on prover_task (uuid) where deleted_at IS NULL;
-- +goose StatementEnd
-- +goose Down