From 291e4e4c3d1b68cbc26f9522d3ecb8afaef4d878 Mon Sep 17 00:00:00 2001 From: frrist Date: Wed, 26 Aug 2020 16:48:32 -0700 Subject: [PATCH] create tables in right order --- cmd/lotus-chainwatch/processor/market.go | 15 +++++++++++++++ cmd/lotus-chainwatch/processor/miner.go | 13 ------------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/cmd/lotus-chainwatch/processor/market.go b/cmd/lotus-chainwatch/processor/market.go index 11f02271ed5..ea06db4436c 100644 --- a/cmd/lotus-chainwatch/processor/market.go +++ b/cmd/lotus-chainwatch/processor/market.go @@ -61,6 +61,21 @@ create table if not exists market_deal_states ); +create table if not exists minerid_dealid_sectorid +( + deal_id bigint not null + constraint sectors_sector_ids_id_fk + references market_deal_proposals(deal_id), + + sector_id bigint not null, + miner_id text not null, + foreign key (sector_id, miner_id) references sector_precommit_info(sector_id, miner_id), + + constraint miner_sector_deal_ids_pk + primary key (miner_id, sector_id, deal_id) +); + + `); err != nil { return err } diff --git a/cmd/lotus-chainwatch/processor/miner.go b/cmd/lotus-chainwatch/processor/miner.go index 3a3710c66f0..57f821ff264 100644 --- a/cmd/lotus-chainwatch/processor/miner.go +++ b/cmd/lotus-chainwatch/processor/miner.go @@ -130,19 +130,6 @@ create table if not exists miner_sector_events primary key (sector_id, event, miner_id, state_root) ); -create table if not exists minerid_dealid_sectorid -( - deal_id bigint not null - constraint sectors_sector_ids_id_fk - references market_deal_proposals(deal_id), - - sector_id bigint not null, - miner_id text not null, - foreign key (sector_id, miner_id) references sector_precommit_info(sector_id, miner_id), - - constraint miner_sector_deal_ids_pk - primary key (miner_id, sector_id, deal_id) -); `); err != nil { return err