Skip to content

Commit

Permalink
Fix the migration
Browse files Browse the repository at this point in the history
  • Loading branch information
popzxc committed Sep 6, 2024
1 parent 42db941 commit 0c4e753
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
UPDATE protocol_patches SET recursion_scheduler_level_vk_hash = snark_wrapper_vk_hash WHERE recursion_scheduler_level_vk_hash = ''::bytea;
ALTER TABLE protocol_patches DROP COLUMN snark_wrapper_vk_hash;
ALTER TABLE protocol_patches ALTER COLUMN recursion_scheduler_level_vk_hash DROP DEFAULT;
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
ALTER TABLE protocol_patches ADD COLUMN snark_wrapper_vk_hash BYTEA NOT NULL;
ALTER TABLE protocol_patches ADD COLUMN snark_wrapper_vk_hash BYTEA NOT NULL DEFAULT ''::bytea;
ALTER TABLE protocol_patches ALTER COLUMN recursion_scheduler_level_vk_hash SET DEFAULT ''::bytea;
UPDATE protocol_patches SET snark_wrapper_vk_hash = recursion_scheduler_level_vk_hash;
-- Default was only needed to migrate old rows, we don't want this field to be forgotten by accident after migration.
ALTER TABLE protocol_patches ALTER COLUMN snark_wrapper_vk_hash DROP DEFAULT;

-- Old column should be removed once the migration is on the mainnet.
COMMENT ON COLUMN protocol_patches.recursion_scheduler_level_vk_hash IS 'This column is deprecated and will be removed in the future. Use snark_wrapper_vk_hash instead.';
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
UPDATE prover_fri_protocol_versions SET recursion_scheduler_level_vk_hash = snark_wrapper_vk_hash WHERE recursion_scheduler_level_vk_hash = ''::bytea;
ALTER TABLE prover_fri_protocol_versions DROP COLUMN snark_wrapper_vk_hash;
ALTER TABLE prover_fri_protocol_versions ALTER COLUMN recursion_scheduler_level_vk_hash DROP DEFAULT;
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
ALTER TABLE prover_fri_protocol_versions ADD COLUMN snark_wrapper_vk_hash BYTEA NOT NULL;
ALTER TABLE prover_fri_protocol_versions ADD COLUMN snark_wrapper_vk_hash BYTEA NOT NULL DEFAULT ''::bytea;
ALTER TABLE prover_fri_protocol_versions ALTER COLUMN recursion_scheduler_level_vk_hash SET DEFAULT ''::bytea;
UPDATE prover_fri_protocol_versions SET snark_wrapper_vk_hash = recursion_scheduler_level_vk_hash;
-- Default was only needed to migrate old rows, we don't want this field to be forgotten by accident after migration.
ALTER TABLE prover_fri_protocol_versions ALTER COLUMN snark_wrapper_vk_hash DROP DEFAULT;

-- Old column should be removed once the migration is on the mainnet.
COMMENT ON COLUMN prover_fri_protocol_versions.recursion_scheduler_level_vk_hash IS 'This column is deprecated and will be removed in the future. Use snark_wrapper_vk_hash instead.';

0 comments on commit 0c4e753

Please sign in to comment.