Skip to content

Commit

Permalink
add empty bal spec (#13839)
Browse files Browse the repository at this point in the history
* add empty bal spec

* add bal_spec_id

* include ccip spec ids

* remove orm changes

* add changeset

* add tag

---------

Co-authored-by: Chris <104409744+vreff@users.noreply.github.com>
  • Loading branch information
jinhoonbang and vreff authored Jul 12, 2024
1 parent fb177f4 commit 48b11dd
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/eighty-points-bathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

#db_update add an empty BAL spec in migrations
1 change: 1 addition & 0 deletions core/services/job/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ type Job struct {
BlockhashStoreSpec *BlockhashStoreSpec
BlockHeaderFeederSpecID *int32
BlockHeaderFeederSpec *BlockHeaderFeederSpec
BALSpecID *int32
LegacyGasStationServerSpecID *int32
LegacyGasStationServerSpec *LegacyGasStationServerSpec
LegacyGasStationSidecarSpecID *int32
Expand Down
61 changes: 61 additions & 0 deletions core/store/migrate/migrations/0247_bal_spec_placeholder.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
-- +goose Up
CREATE TABLE bal_specs (
id BIGSERIAL PRIMARY KEY
);
ALTER TABLE
jobs
ADD
COLUMN bal_spec_id INT REFERENCES bal_specs (id),
DROP
CONSTRAINT chk_specs,
ADD
CONSTRAINT chk_specs CHECK (
num_nonnulls(
ocr_oracle_spec_id, ocr2_oracle_spec_id,
direct_request_spec_id, flux_monitor_spec_id,
keeper_spec_id, cron_spec_id, webhook_spec_id,
vrf_spec_id, blockhash_store_spec_id,
block_header_feeder_spec_id, bootstrap_spec_id,
gateway_spec_id,
legacy_gas_station_server_spec_id,
legacy_gas_station_sidecar_spec_id,
eal_spec_id,
workflow_spec_id,
standard_capabilities_spec_id,
ccip_spec_id,
ccip_bootstrap_spec_id,
bal_spec_id,
CASE "type" WHEN 'stream' THEN 1 ELSE NULL END -- 'stream' type lacks a spec but should not cause validation to fail
) = 1
);

-- +goose Down
ALTER TABLE
jobs
DROP
CONSTRAINT chk_specs,
ADD
CONSTRAINT chk_specs CHECK (
num_nonnulls(
ocr_oracle_spec_id, ocr2_oracle_spec_id,
direct_request_spec_id, flux_monitor_spec_id,
keeper_spec_id, cron_spec_id, webhook_spec_id,
vrf_spec_id, blockhash_store_spec_id,
block_header_feeder_spec_id, bootstrap_spec_id,
gateway_spec_id,
legacy_gas_station_server_spec_id,
legacy_gas_station_sidecar_spec_id,
eal_spec_id,
workflow_spec_id,
standard_capabilities_spec_id,
ccip_spec_id,
ccip_bootstrap_spec_id,
CASE "type" WHEN 'stream' THEN 1 ELSE NULL END -- 'stream' type lacks a spec but should not cause validation to fail
) = 1
);
ALTER TABLE
jobs
DROP
COLUMN bal_spec_id;
DROP
TABLE IF EXISTS bal_specs;

0 comments on commit 48b11dd

Please sign in to comment.