Skip to content

Commit

Permalink
Merge pull request #10355 from vegaprotocol/fix/move-db-migrations
Browse files Browse the repository at this point in the history
fix: renumbered SQL migration scripts 0055-0067
  • Loading branch information
jeremyletang authored Jan 10, 2024
2 parents c546152 + 65ca3cd commit 21f372e
Show file tree
Hide file tree
Showing 18 changed files with 28 additions and 18 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
- [10324](https://github.com/vegaprotocol/vega/issues/10324) - Fix `GetMarketHistoryByID` to only return the most recent market data information when no dates are provided.
- [10318](https://github.com/vegaprotocol/vega/issues/10318) - Prevent stop orders being placed during opening auction.
- [476](https://github.com/vegaprotocol/core-test-coverage/issues/476) - Add tests for markets expiring in opening auction, fix a bug for future markets.
- [10354](https://github.com/vegaprotocol/vega/issues/10354) - Renumbered SQL migration scripts 0055-0067 due to 0068 being released as part of a patch without renumbering.

## 0.73.0

Expand Down
12 changes: 6 additions & 6 deletions datanode/networkhistory/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,12 +379,12 @@ func TestMain(t *testing.M) {
log.Infof("%s", goldenSourceHistorySegment[4000].HistorySegmentID)
log.Infof("%s", goldenSourceHistorySegment[5000].HistorySegmentID)

panicIfHistorySegmentIdsNotEqual(goldenSourceHistorySegment[1000].HistorySegmentID, "QmTwduUMq6MBaH7encKNvsCj5tjj74KA834uVxbFB21Pmz", snapshots)
panicIfHistorySegmentIdsNotEqual(goldenSourceHistorySegment[2000].HistorySegmentID, "QmPmCaKdUcDJAnokJ8mE8wgWoc6v1vsYySJEBQa1ULRhtP", snapshots)
panicIfHistorySegmentIdsNotEqual(goldenSourceHistorySegment[2500].HistorySegmentID, "QmYX27Vqt1C4WLYWeXPHiY4jBUg3ftAxcJEombX4PVMN3L", snapshots)
panicIfHistorySegmentIdsNotEqual(goldenSourceHistorySegment[3000].HistorySegmentID, "QmPxbdr6HWG3WX3LnngQpV2uUq96cCfHKKMLnmE8zmbdBJ", snapshots)
panicIfHistorySegmentIdsNotEqual(goldenSourceHistorySegment[4000].HistorySegmentID, "QmaY9PfcTJkifg2vuMm5VZJyMqNJgc9eHiQe3bFA98TTuC", snapshots)
panicIfHistorySegmentIdsNotEqual(goldenSourceHistorySegment[5000].HistorySegmentID, "QmSvATR4ZK4KzwWBWkd9zeZh8Num6jcYWDGXQEBwZEsgMh", snapshots)
panicIfHistorySegmentIdsNotEqual(goldenSourceHistorySegment[1000].HistorySegmentID, "QmQR9PFgUvndcpD7qCTe1w9mBty4NEHXozHqG95Q1Q46oo", snapshots)
panicIfHistorySegmentIdsNotEqual(goldenSourceHistorySegment[2000].HistorySegmentID, "QmccyZL8hLMtSD9TeffNabLkCfHZF8AoU4wzyyjTMJ3t6T", snapshots)
panicIfHistorySegmentIdsNotEqual(goldenSourceHistorySegment[2500].HistorySegmentID, "QmRqJQKMnYj5n17dodijubHZfNFgMzJu2tZCBA5EaC3ZrU", snapshots)
panicIfHistorySegmentIdsNotEqual(goldenSourceHistorySegment[3000].HistorySegmentID, "QmQoU4uBTvac51woarfbgKS84Lgnhe4j3uG6kdrvo3QXty", snapshots)
panicIfHistorySegmentIdsNotEqual(goldenSourceHistorySegment[4000].HistorySegmentID, "QmYNZ9HtzJ4yFnGwBX6S53ES2j9VPDs1qQdUN9VZdh8bR2", snapshots)
panicIfHistorySegmentIdsNotEqual(goldenSourceHistorySegment[5000].HistorySegmentID, "QmVEdCwD9aWuDUNjJRVmCNM2CbQedaXrgcfrqVH8GctqBa", snapshots)
}, postgresRuntimePath, sqlFs)

if exitCode != 0 {
Expand Down
2 changes: 2 additions & 0 deletions datanode/sqlstore/migrations/0055-0067_moved_to_0069-0080.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
The scripts numbered 0055-0067 were moved to 0069-0080 respectively
as 0068 was released in a patch without renumbering.
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,3 @@ RETURN NULL;
END;
$$;
-- +goose StatementEnd

Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ CREATE INDEX transfer_fees_discount_asset_id_idx ON transfer_fees_discount(asset
ALTER TABLE transfer_fees DROP COLUMN discount_applied;
DROP INDEX transfer_fees_discount_party_id_idx;
DROP INDEX transfer_fees_discount_asset_id_idx;
DROP TABLE IF EXISTS transfer_fees_discount;
DROP TABLE IF EXISTS transfer_fees_discount;
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
-- +goose Up
DROP TYPE IF EXISTS margin_mode_type;
create type margin_mode_type as enum('MARGIN_MODE_UNSPECIFIED', 'MARGIN_MODE_CROSS_MARGIN', 'MARGIN_MODE_ISOLATED_MARGIN');

-- +goose StatementBegin
DO
$$
BEGIN
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'margin_mode_type') THEN
CREATE TYPE margin_mode_type as enum('MARGIN_MODE_UNSPECIFIED', 'MARGIN_MODE_CROSS_MARGIN', 'MARGIN_MODE_ISOLATED_MARGIN');
END IF;
END;
$$
LANGUAGE plpgsql;
-- +goose StatementEnd

alter table margin_levels
add column if not exists margin_mode margin_mode_type not null default ('MARGIN_MODE_CROSS_MARGIN'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ 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';

-- +goose StatementBegin
UPDATE proposals
UPDATE proposals
SET terms = jsonb_set(
terms,
'{terms, updateMarket, changes}',
terms,
'{terms, updateMarket, changes}',
terms #> '{terms, updateMarket, changes}' || '{"markPriceConfiguration": {"decayWeight": "0", "decayPower": 0, "cashAmount":"0","compositePriceType":"COMPOSITE_PRICE_TYPE_LAST_TRADE"}}'
)
WHERE terms @> '{"terms": {"updateMarket": {}}}';

UPDATE proposals
UPDATE proposals
SET terms = jsonb_set(
terms,
'{terms, newMarket, changes}',
terms,
'{terms, newMarket, changes}',
terms #> '{terms, newMarket, changes}' || '{"markPriceConfiguration": {"decayWeight": "0", "decayPower": 0, "cashAmount":"0","compositePriceType":"COMPOSITE_PRICE_TYPE_LAST_TRADE"}}'
)
WHERE terms @> '{"terms": {"newMarket": {}}}';
Expand Down Expand Up @@ -106,5 +106,3 @@ RETURN NULL;
END;
$$;
-- +goose StatementEnd


0 comments on commit 21f372e

Please sign in to comment.