Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(blobstorage): fix blobstorage-down-migrations #16944

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ CREATE TABLE IF NOT EXISTS blob_hashes (
);

-- +goose StatementEnd

-- +goose Down
-- +goose StatementBegin
DROP TABLE blob_hashes;
-- +goose StatementEnd
DROP TABLE IF EXISTS blocks_meta;

DROP TABLE IF EXISTS blob_hashes;
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@ FROM blob_hashes;

-- update indexes
DROP INDEX block_id_index on blob_hashes;
ALTER TABLE blocks_meta ADD INDEX `block_id_index` (`block_id`);

-- +goose Down
-- reverse indexes
DROP INDEX block_id_index on blocks_meta;
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
Loading