Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaodino committed May 1, 2024
1 parent a8f9720 commit a32c7bb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
9 changes: 9 additions & 0 deletions packages/blobstorage/migrations/16669_add_blob_hash_index.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- +goose Up
-- +goose StatementBegin
ALTER TABLE `blob_hashes` ADD INDEX `blob_hash_index` (`blob_hash`);

-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP INDEX blob_hash_index on blob_hashes;
-- +goose StatementEnd
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,5 @@ FROM blob_hashes;
DROP INDEX block_id_index on blob_hashes;

-- +goose Down
-- reverse indexes
ALTER TABLE blob_hashes ADD INDEX `block_id_index` (`block_id`);

-- drop blocks_meta table
DROP TABLE IF EXISTS blocks_meta;
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ UPDATE blocks_meta bm
JOIN blob_hashes_temp bh ON bm.blob_hash = bh.blob_hash
SET bm.blob_hash = bh.blob_hash;

ALTER TABLE blocks_meta DROP FOREIGN KEY blocks_meta_ibfk_1;

ALTER TABLE `blob_hashes_temp` ADD INDEX `blob_hash_index` (`blob_hash`);

-- make blob_hashes_temp the new blob_hashes
Expand Down Expand Up @@ -60,7 +58,8 @@ UPDATE blocks_meta bm
JOIN blob_hashes_temp bh ON bm.blob_hash = bh.blob_hash
SET bm.blob_hash = bh.blob_hash;

DROP INDEX `blob_hash_index` on blob_hashes_temp;
-- create blob_hash_index
ALTER TABLE `blob_hashes_temp` ADD INDEX `blob_hash_index` (`blob_hash`);

-- make blob_hashes_temp the new blob_hashes
DROP TABLE IF EXISTS blob_hashes;
Expand Down

0 comments on commit a32c7bb

Please sign in to comment.