From 16a9b84e669f6e4a2bac485101781c6f0d0403f6 Mon Sep 17 00:00:00 2001 From: Tan Quach Date: Wed, 10 Jan 2024 18:15:04 +0000 Subject: [PATCH] fix: slow migration in 0083 --- datanode/sqlstore/migrations/0083_mark_price.sql | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/datanode/sqlstore/migrations/0083_mark_price.sql b/datanode/sqlstore/migrations/0083_mark_price.sql index 1960b4e0fb..694167e0f0 100644 --- a/datanode/sqlstore/migrations/0083_mark_price.sql +++ b/datanode/sqlstore/migrations/0083_mark_price.sql @@ -1,11 +1,12 @@ -- +goose Up create type composite_price_type as enum('COMPOSITE_PRICE_TYPE_UNSPECIFIED','COMPOSITE_PRICE_TYPE_WEIGHTED','COMPOSITE_PRICE_TYPE_MEDIAN','COMPOSITE_PRICE_TYPE_LAST_TRADE'); -alter table market_data add column if not exists mark_price_type composite_price_type; +alter table market_data add column if not exists mark_price_type composite_price_type not null default('COMPOSITE_PRICE_TYPE_LAST_TRADE'); alter table current_market_data add column if not exists mark_price_type composite_price_type; -update market_data set mark_price_type = 'COMPOSITE_PRICE_TYPE_LAST_TRADE'; update current_market_data set mark_price_type = 'COMPOSITE_PRICE_TYPE_LAST_TRADE'; +alter table current_market_data alter mark_price_type set not null; + -- +goose StatementBegin UPDATE proposals SET terms = jsonb_set(