Skip to content

Commit b6e7c3e

Browse files
committed
fix: use unique key
1 parent 4c988a9 commit b6e7c3e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

database/migrate/migrations/00027_ blob_upload.sql

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ CREATE TABLE blob_upload (
1010
-- metadata
1111
created_at TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP,
1212
updated_at TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP,
13-
deleted_at TIMESTAMP(0) DEFAULT NULL,
14-
15-
PRIMARY KEY (batch_index, platform)
13+
deleted_at TIMESTAMP(0) DEFAULT NULL
1614
);
1715

16+
CREATE UNIQUE INDEX IF NOT EXISTS batch_index_platform_uindex
17+
ON blob_upload(batch_index, platform) WHERE deleted_at IS NULL;
18+
1819
COMMENT ON COLUMN blob_upload.status IS 'undefined, pending, uploaded, failed';
1920

2021
CREATE INDEX IF NOT EXISTS idx_blob_upload_batch_index ON blob_upload(batch_index) WHERE deleted_at IS NULL;

0 commit comments

Comments
 (0)