forked from cerc-io/ipld-eth-server
Update tend, flipkick and dent tables for consistency (#24)
This commit is contained in:
parent
06881db350
commit
60901d9095
@ -1,13 +1,14 @@
|
|||||||
CREATE TABLE maker.flip_kick (
|
CREATE TABLE maker.flip_kick (
|
||||||
db_id SERIAL PRIMARY KEY,
|
id SERIAL PRIMARY KEY,
|
||||||
header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE,
|
header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE,
|
||||||
id NUMERIC NOT NULL UNIQUE,
|
bid_id NUMERIC NOT NULL,
|
||||||
lot NUMERIC,
|
lot NUMERIC,
|
||||||
bid NUMERIC,
|
bid NUMERIC,
|
||||||
gal VARCHAR,
|
gal VARCHAR,
|
||||||
"end" TIMESTAMP WITH TIME ZONE,
|
"end" TIMESTAMP WITH TIME ZONE,
|
||||||
urn VARCHAR,
|
urn VARCHAR,
|
||||||
tab NUMERIC,
|
tab NUMERIC,
|
||||||
tx_idx INTEGER NOT NUll,
|
tx_idx INTEGER NOT NUll,
|
||||||
raw_log JSONB
|
raw_log JSONB,
|
||||||
|
UNIQUE (header_id, tx_idx)
|
||||||
);
|
);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
CREATE TABLE maker.tend (
|
CREATE TABLE maker.tend (
|
||||||
db_id SERIAL PRIMARY KEY,
|
id SERIAL PRIMARY KEY,
|
||||||
header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE,
|
header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE,
|
||||||
bid_id NUMERIC NOT NULL UNIQUE,
|
bid_id NUMERIC NOT NULL UNIQUE,
|
||||||
lot NUMERIC,
|
lot NUMERIC,
|
||||||
@ -7,5 +7,6 @@ CREATE TABLE maker.tend (
|
|||||||
guy VARCHAR,
|
guy VARCHAR,
|
||||||
tic NUMERIC,
|
tic NUMERIC,
|
||||||
tx_idx INTEGER NOT NUll,
|
tx_idx INTEGER NOT NUll,
|
||||||
raw_log JSONB
|
raw_log JSONB,
|
||||||
|
UNIQUE (header_id, tx_idx)
|
||||||
);
|
);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
CREATE TABLE maker.dent (
|
CREATE TABLE maker.dent (
|
||||||
db_id SERIAL PRIMARY KEY,
|
id SERIAL PRIMARY KEY,
|
||||||
header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE,
|
header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE,
|
||||||
bid_id NUMERIC NOT NULL UNIQUE,
|
bid_id NUMERIC NOT NULL UNIQUE,
|
||||||
lot NUMERIC,
|
lot NUMERIC,
|
||||||
@ -7,5 +7,6 @@ CREATE TABLE maker.dent (
|
|||||||
guy BYTEA,
|
guy BYTEA,
|
||||||
tic NUMERIC,
|
tic NUMERIC,
|
||||||
tx_idx INTEGER NOT NUll,
|
tx_idx INTEGER NOT NUll,
|
||||||
raw_log JSONB
|
raw_log JSONB,
|
||||||
|
UNIQUE (header_id, tx_idx)
|
||||||
);
|
);
|
||||||
|
@ -133,7 +133,7 @@ ALTER SEQUENCE maker.deal_id_seq OWNED BY maker.deal.id;
|
|||||||
--
|
--
|
||||||
|
|
||||||
CREATE TABLE maker.dent (
|
CREATE TABLE maker.dent (
|
||||||
db_id integer NOT NULL,
|
id integer NOT NULL,
|
||||||
header_id integer NOT NULL,
|
header_id integer NOT NULL,
|
||||||
bid_id numeric NOT NULL,
|
bid_id numeric NOT NULL,
|
||||||
lot numeric,
|
lot numeric,
|
||||||
@ -146,10 +146,10 @@ CREATE TABLE maker.dent (
|
|||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: dent_db_id_seq; Type: SEQUENCE; Schema: maker; Owner: -
|
-- Name: dent_id_seq; Type: SEQUENCE; Schema: maker; Owner: -
|
||||||
--
|
--
|
||||||
|
|
||||||
CREATE SEQUENCE maker.dent_db_id_seq
|
CREATE SEQUENCE maker.dent_id_seq
|
||||||
AS integer
|
AS integer
|
||||||
START WITH 1
|
START WITH 1
|
||||||
INCREMENT BY 1
|
INCREMENT BY 1
|
||||||
@ -159,10 +159,10 @@ CREATE SEQUENCE maker.dent_db_id_seq
|
|||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: dent_db_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: -
|
-- Name: dent_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: -
|
||||||
--
|
--
|
||||||
|
|
||||||
ALTER SEQUENCE maker.dent_db_id_seq OWNED BY maker.dent.db_id;
|
ALTER SEQUENCE maker.dent_id_seq OWNED BY maker.dent.id;
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -306,9 +306,9 @@ ALTER SEQUENCE maker.drip_file_vow_id_seq OWNED BY maker.drip_file_vow.id;
|
|||||||
--
|
--
|
||||||
|
|
||||||
CREATE TABLE maker.flip_kick (
|
CREATE TABLE maker.flip_kick (
|
||||||
db_id integer NOT NULL,
|
id integer NOT NULL,
|
||||||
header_id integer NOT NULL,
|
header_id integer NOT NULL,
|
||||||
id numeric NOT NULL,
|
bid_id numeric NOT NULL,
|
||||||
lot numeric,
|
lot numeric,
|
||||||
bid numeric,
|
bid numeric,
|
||||||
gal character varying,
|
gal character varying,
|
||||||
@ -321,10 +321,10 @@ CREATE TABLE maker.flip_kick (
|
|||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: flip_kick_db_id_seq; Type: SEQUENCE; Schema: maker; Owner: -
|
-- Name: flip_kick_id_seq; Type: SEQUENCE; Schema: maker; Owner: -
|
||||||
--
|
--
|
||||||
|
|
||||||
CREATE SEQUENCE maker.flip_kick_db_id_seq
|
CREATE SEQUENCE maker.flip_kick_id_seq
|
||||||
AS integer
|
AS integer
|
||||||
START WITH 1
|
START WITH 1
|
||||||
INCREMENT BY 1
|
INCREMENT BY 1
|
||||||
@ -334,10 +334,10 @@ CREATE SEQUENCE maker.flip_kick_db_id_seq
|
|||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: flip_kick_db_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: -
|
-- Name: flip_kick_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: -
|
||||||
--
|
--
|
||||||
|
|
||||||
ALTER SEQUENCE maker.flip_kick_db_id_seq OWNED BY maker.flip_kick.db_id;
|
ALTER SEQUENCE maker.flip_kick_id_seq OWNED BY maker.flip_kick.id;
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -522,7 +522,7 @@ ALTER SEQUENCE maker.price_feeds_id_seq OWNED BY maker.price_feeds.id;
|
|||||||
--
|
--
|
||||||
|
|
||||||
CREATE TABLE maker.tend (
|
CREATE TABLE maker.tend (
|
||||||
db_id integer NOT NULL,
|
id integer NOT NULL,
|
||||||
header_id integer NOT NULL,
|
header_id integer NOT NULL,
|
||||||
bid_id numeric NOT NULL,
|
bid_id numeric NOT NULL,
|
||||||
lot numeric,
|
lot numeric,
|
||||||
@ -535,10 +535,10 @@ CREATE TABLE maker.tend (
|
|||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: tend_db_id_seq; Type: SEQUENCE; Schema: maker; Owner: -
|
-- Name: tend_id_seq; Type: SEQUENCE; Schema: maker; Owner: -
|
||||||
--
|
--
|
||||||
|
|
||||||
CREATE SEQUENCE maker.tend_db_id_seq
|
CREATE SEQUENCE maker.tend_id_seq
|
||||||
AS integer
|
AS integer
|
||||||
START WITH 1
|
START WITH 1
|
||||||
INCREMENT BY 1
|
INCREMENT BY 1
|
||||||
@ -548,10 +548,10 @@ CREATE SEQUENCE maker.tend_db_id_seq
|
|||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: tend_db_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: -
|
-- Name: tend_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: -
|
||||||
--
|
--
|
||||||
|
|
||||||
ALTER SEQUENCE maker.tend_db_id_seq OWNED BY maker.tend.db_id;
|
ALTER SEQUENCE maker.tend_id_seq OWNED BY maker.tend.id;
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -1005,10 +1005,10 @@ ALTER TABLE ONLY maker.deal ALTER COLUMN id SET DEFAULT nextval('maker.deal_id_s
|
|||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: dent db_id; Type: DEFAULT; Schema: maker; Owner: -
|
-- Name: dent id; Type: DEFAULT; Schema: maker; Owner: -
|
||||||
--
|
--
|
||||||
|
|
||||||
ALTER TABLE ONLY maker.dent ALTER COLUMN db_id SET DEFAULT nextval('maker.dent_db_id_seq'::regclass);
|
ALTER TABLE ONLY maker.dent ALTER COLUMN id SET DEFAULT nextval('maker.dent_id_seq'::regclass);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -1040,10 +1040,10 @@ ALTER TABLE ONLY maker.drip_file_vow ALTER COLUMN id SET DEFAULT nextval('maker.
|
|||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: flip_kick db_id; Type: DEFAULT; Schema: maker; Owner: -
|
-- Name: flip_kick id; Type: DEFAULT; Schema: maker; Owner: -
|
||||||
--
|
--
|
||||||
|
|
||||||
ALTER TABLE ONLY maker.flip_kick ALTER COLUMN db_id SET DEFAULT nextval('maker.flip_kick_db_id_seq'::regclass);
|
ALTER TABLE ONLY maker.flip_kick ALTER COLUMN id SET DEFAULT nextval('maker.flip_kick_id_seq'::regclass);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -1082,10 +1082,10 @@ ALTER TABLE ONLY maker.price_feeds ALTER COLUMN id SET DEFAULT nextval('maker.pr
|
|||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: tend db_id; Type: DEFAULT; Schema: maker; Owner: -
|
-- Name: tend id; Type: DEFAULT; Schema: maker; Owner: -
|
||||||
--
|
--
|
||||||
|
|
||||||
ALTER TABLE ONLY maker.tend ALTER COLUMN db_id SET DEFAULT nextval('maker.tend_db_id_seq'::regclass);
|
ALTER TABLE ONLY maker.tend ALTER COLUMN id SET DEFAULT nextval('maker.tend_id_seq'::regclass);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -1205,12 +1205,20 @@ ALTER TABLE ONLY maker.dent
|
|||||||
ADD CONSTRAINT dent_bid_id_key UNIQUE (bid_id);
|
ADD CONSTRAINT dent_bid_id_key UNIQUE (bid_id);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: dent dent_header_id_tx_idx_key; Type: CONSTRAINT; Schema: maker; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER TABLE ONLY maker.dent
|
||||||
|
ADD CONSTRAINT dent_header_id_tx_idx_key UNIQUE (header_id, tx_idx);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: dent dent_pkey; Type: CONSTRAINT; Schema: maker; Owner: -
|
-- Name: dent dent_pkey; Type: CONSTRAINT; Schema: maker; Owner: -
|
||||||
--
|
--
|
||||||
|
|
||||||
ALTER TABLE ONLY maker.dent
|
ALTER TABLE ONLY maker.dent
|
||||||
ADD CONSTRAINT dent_pkey PRIMARY KEY (db_id);
|
ADD CONSTRAINT dent_pkey PRIMARY KEY (id);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -1278,11 +1286,11 @@ ALTER TABLE ONLY maker.drip_file_vow
|
|||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: flip_kick flip_kick_id_key; Type: CONSTRAINT; Schema: maker; Owner: -
|
-- Name: flip_kick flip_kick_header_id_tx_idx_key; Type: CONSTRAINT; Schema: maker; Owner: -
|
||||||
--
|
--
|
||||||
|
|
||||||
ALTER TABLE ONLY maker.flip_kick
|
ALTER TABLE ONLY maker.flip_kick
|
||||||
ADD CONSTRAINT flip_kick_id_key UNIQUE (id);
|
ADD CONSTRAINT flip_kick_header_id_tx_idx_key UNIQUE (header_id, tx_idx);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -1290,7 +1298,7 @@ ALTER TABLE ONLY maker.flip_kick
|
|||||||
--
|
--
|
||||||
|
|
||||||
ALTER TABLE ONLY maker.flip_kick
|
ALTER TABLE ONLY maker.flip_kick
|
||||||
ADD CONSTRAINT flip_kick_pkey PRIMARY KEY (db_id);
|
ADD CONSTRAINT flip_kick_pkey PRIMARY KEY (id);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -1381,12 +1389,20 @@ ALTER TABLE ONLY maker.tend
|
|||||||
ADD CONSTRAINT tend_bid_id_key UNIQUE (bid_id);
|
ADD CONSTRAINT tend_bid_id_key UNIQUE (bid_id);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: tend tend_header_id_tx_idx_key; Type: CONSTRAINT; Schema: maker; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER TABLE ONLY maker.tend
|
||||||
|
ADD CONSTRAINT tend_header_id_tx_idx_key UNIQUE (header_id, tx_idx);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: tend tend_pkey; Type: CONSTRAINT; Schema: maker; Owner: -
|
-- Name: tend tend_pkey; Type: CONSTRAINT; Schema: maker; Owner: -
|
||||||
--
|
--
|
||||||
|
|
||||||
ALTER TABLE ONLY maker.tend
|
ALTER TABLE ONLY maker.tend
|
||||||
ADD CONSTRAINT tend_pkey PRIMARY KEY (db_id);
|
ADD CONSTRAINT tend_pkey PRIMARY KEY (id);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
|
@ -73,7 +73,7 @@ func (FlipKickConverter) ToModel(flipKick FlipKickEntity) (FlipKickModel, error)
|
|||||||
rawLogString := string(rawLogJson)
|
rawLogString := string(rawLogJson)
|
||||||
|
|
||||||
return FlipKickModel{
|
return FlipKickModel{
|
||||||
Id: id,
|
BidId: id,
|
||||||
Lot: lot,
|
Lot: lot,
|
||||||
Bid: bid,
|
Bid: bid,
|
||||||
Gal: gal,
|
Gal: gal,
|
||||||
|
@ -81,7 +81,7 @@ var _ = Describe("FlipKick Converter", func() {
|
|||||||
model, err := converter.ToModel(emptyEntity)
|
model, err := converter.ToModel(emptyEntity)
|
||||||
|
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(model.Id).To(Equal("1"))
|
Expect(model.BidId).To(Equal("1"))
|
||||||
Expect(model.Lot).To(Equal(emptyString))
|
Expect(model.Lot).To(Equal(emptyString))
|
||||||
Expect(model.Bid).To(Equal(emptyString))
|
Expect(model.Bid).To(Equal(emptyString))
|
||||||
Expect(model.Gal).To(Equal(emptyAddressHex))
|
Expect(model.Gal).To(Equal(emptyAddressHex))
|
||||||
|
@ -17,7 +17,7 @@ package flip_kick
|
|||||||
import "time"
|
import "time"
|
||||||
|
|
||||||
type FlipKickModel struct {
|
type FlipKickModel struct {
|
||||||
Id string
|
BidId string `db:"bid_id"`
|
||||||
Lot string
|
Lot string
|
||||||
Bid string
|
Bid string
|
||||||
Gal string
|
Gal string
|
||||||
|
@ -35,9 +35,9 @@ func NewFlipKickRepository(db *postgres.DB) FlipKickRepository {
|
|||||||
}
|
}
|
||||||
func (fkr FlipKickRepository) Create(headerId int64, flipKick FlipKickModel) error {
|
func (fkr FlipKickRepository) Create(headerId int64, flipKick FlipKickModel) error {
|
||||||
_, err := fkr.DB.Exec(
|
_, err := fkr.DB.Exec(
|
||||||
`INSERT into maker.flip_kick (header_id, id, lot, bid, gal, "end", urn, tab, tx_idx, raw_log)
|
`INSERT into maker.flip_kick (header_id, bid_id, lot, bid, gal, "end", urn, tab, tx_idx, raw_log)
|
||||||
VALUES($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)`,
|
VALUES($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)`,
|
||||||
headerId, flipKick.Id, flipKick.Lot, flipKick.Bid, flipKick.Gal, flipKick.End, flipKick.Urn, flipKick.Tab, flipKick.TransactionIndex, flipKick.Raw,
|
headerId, flipKick.BidId, flipKick.Lot, flipKick.Bid, flipKick.Gal, flipKick.End, flipKick.Urn, flipKick.Tab, flipKick.TransactionIndex, flipKick.Raw,
|
||||||
)
|
)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ var _ = Describe("FlipKick Repository", func() {
|
|||||||
err = flipKickRepository.DB.QueryRowx(`SELECT * FROM maker.flip_kick`).StructScan(&dbResult)
|
err = flipKickRepository.DB.QueryRowx(`SELECT * FROM maker.flip_kick`).StructScan(&dbResult)
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(dbResult.HeaderId).To(Equal(headerId))
|
Expect(dbResult.HeaderId).To(Equal(headerId))
|
||||||
Expect(dbResult.Id).To(Equal(flipKick.Id))
|
Expect(dbResult.BidId).To(Equal(flipKick.BidId))
|
||||||
Expect(dbResult.Lot).To(Equal(flipKick.Lot))
|
Expect(dbResult.Lot).To(Equal(flipKick.Lot))
|
||||||
Expect(dbResult.Bid).To(Equal(flipKick.Bid))
|
Expect(dbResult.Bid).To(Equal(flipKick.Bid))
|
||||||
Expect(dbResult.Gal).To(Equal(flipKick.Gal))
|
Expect(dbResult.Gal).To(Equal(flipKick.Gal))
|
||||||
|
@ -80,7 +80,7 @@ var FlipKickEntity = flip_kick.FlipKickEntity{
|
|||||||
}
|
}
|
||||||
|
|
||||||
var FlipKickModel = flip_kick.FlipKickModel{
|
var FlipKickModel = flip_kick.FlipKickModel{
|
||||||
Id: idString,
|
BidId: idString,
|
||||||
Lot: lotString,
|
Lot: lotString,
|
||||||
Bid: bidString,
|
Bid: bidString,
|
||||||
Gal: gal,
|
Gal: gal,
|
||||||
@ -92,7 +92,7 @@ var FlipKickModel = flip_kick.FlipKickModel{
|
|||||||
}
|
}
|
||||||
|
|
||||||
type FlipKickDBRow struct {
|
type FlipKickDBRow struct {
|
||||||
DbID int64 `db:"db_id"`
|
ID int64
|
||||||
HeaderId int64 `db:"header_id"`
|
HeaderId int64 `db:"header_id"`
|
||||||
flip_kick.FlipKickModel
|
flip_kick.FlipKickModel
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user