Assorted cleanups
- Remove DataDog - Remove token_supply table - Drop from more tables when cleaning DB for tests
This commit is contained in:
parent
cdcb90c170
commit
5eff2618ed
@ -31,7 +31,6 @@ Using Vulcanize for the first time requires several steps be done in order to al
|
|||||||
In order to fetch the project codebase for local use or modification, install it to your `GOPATH` via:
|
In order to fetch the project codebase for local use or modification, install it to your `GOPATH` via:
|
||||||
|
|
||||||
`go get github.com/vulcanize/vulcanizedb`
|
`go get github.com/vulcanize/vulcanizedb`
|
||||||
`go get gopkg.in/DataDog/dd-trace-go.v1/ddtrace`
|
|
||||||
|
|
||||||
Once fetched, dependencies can be installed via `go get` or (the preferred method) at specific versions via `golang/dep`, the prototype golang pakcage manager. Installation instructions are [here](https://golang.github.io/dep/docs/installation.html).
|
Once fetched, dependencies can be installed via `go get` or (the preferred method) at specific versions via `golang/dep`, the prototype golang pakcage manager. Installation instructions are [here](https://golang.github.io/dep/docs/installation.html).
|
||||||
|
|
||||||
|
@ -94,7 +94,6 @@ func init() {
|
|||||||
rootCmd.PersistentFlags().String("database-password", "", "database password")
|
rootCmd.PersistentFlags().String("database-password", "", "database password")
|
||||||
rootCmd.PersistentFlags().String("client-ipcPath", "", "location of geth.ipc file")
|
rootCmd.PersistentFlags().String("client-ipcPath", "", "location of geth.ipc file")
|
||||||
rootCmd.PersistentFlags().String("client-levelDbPath", "", "location of levelDb chaindata")
|
rootCmd.PersistentFlags().String("client-levelDbPath", "", "location of levelDb chaindata")
|
||||||
rootCmd.PersistentFlags().String("datadog-name", "vulcanize-test", "datadog service name")
|
|
||||||
rootCmd.PersistentFlags().String("filesystem-storageDiffsPath", "", "location of storage diffs csv file")
|
rootCmd.PersistentFlags().String("filesystem-storageDiffsPath", "", "location of storage diffs csv file")
|
||||||
rootCmd.PersistentFlags().String("exporter-name", "exporter", "name of exporter plugin")
|
rootCmd.PersistentFlags().String("exporter-name", "exporter", "name of exporter plugin")
|
||||||
|
|
||||||
@ -105,7 +104,6 @@ func init() {
|
|||||||
viper.BindPFlag("database.password", rootCmd.PersistentFlags().Lookup("database-password"))
|
viper.BindPFlag("database.password", rootCmd.PersistentFlags().Lookup("database-password"))
|
||||||
viper.BindPFlag("client.ipcPath", rootCmd.PersistentFlags().Lookup("client-ipcPath"))
|
viper.BindPFlag("client.ipcPath", rootCmd.PersistentFlags().Lookup("client-ipcPath"))
|
||||||
viper.BindPFlag("client.levelDbPath", rootCmd.PersistentFlags().Lookup("client-levelDbPath"))
|
viper.BindPFlag("client.levelDbPath", rootCmd.PersistentFlags().Lookup("client-levelDbPath"))
|
||||||
viper.BindPFlag("datadog.name", rootCmd.PersistentFlags().Lookup("datadog-name"))
|
|
||||||
viper.BindPFlag("filesystem.storageDiffsPath", rootCmd.PersistentFlags().Lookup("filesystem-storageDiffsPath"))
|
viper.BindPFlag("filesystem.storageDiffsPath", rootCmd.PersistentFlags().Lookup("filesystem-storageDiffsPath"))
|
||||||
viper.BindPFlag("exporter.fileName", rootCmd.PersistentFlags().Lookup("exporter-name"))
|
viper.BindPFlag("exporter.fileName", rootCmd.PersistentFlags().Lookup("exporter-name"))
|
||||||
}
|
}
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
-- +goose Up
|
|
||||||
CREATE TABLE token_supply (
|
|
||||||
id SERIAL,
|
|
||||||
block_id INTEGER NOT NULL,
|
|
||||||
supply DECIMAL NOT NULL,
|
|
||||||
token_address CHARACTER VARYING(66) NOT NULL,
|
|
||||||
CONSTRAINT blocks_fk FOREIGN KEY (block_id)
|
|
||||||
REFERENCES blocks (id)
|
|
||||||
ON DELETE CASCADE
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
-- +goose Down
|
|
||||||
DROP TABLE token_supply;
|
|
@ -2,8 +2,8 @@
|
|||||||
-- PostgreSQL database dump
|
-- PostgreSQL database dump
|
||||||
--
|
--
|
||||||
|
|
||||||
-- Dumped from database version 10.5
|
-- Dumped from database version 10.6
|
||||||
-- Dumped by pg_dump version 10.5
|
-- Dumped by pg_dump version 10.6
|
||||||
|
|
||||||
SET statement_timeout = 0;
|
SET statement_timeout = 0;
|
||||||
SET lock_timeout = 0;
|
SET lock_timeout = 0;
|
||||||
@ -368,38 +368,6 @@ CREATE SEQUENCE public.receipts_id_seq
|
|||||||
ALTER SEQUENCE public.receipts_id_seq OWNED BY public.receipts.id;
|
ALTER SEQUENCE public.receipts_id_seq OWNED BY public.receipts.id;
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: token_supply; Type: TABLE; Schema: public; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE public.token_supply (
|
|
||||||
id integer NOT NULL,
|
|
||||||
block_id integer NOT NULL,
|
|
||||||
supply numeric NOT NULL,
|
|
||||||
token_address character varying(66) NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: token_supply_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE SEQUENCE public.token_supply_id_seq
|
|
||||||
AS integer
|
|
||||||
START WITH 1
|
|
||||||
INCREMENT BY 1
|
|
||||||
NO MINVALUE
|
|
||||||
NO MAXVALUE
|
|
||||||
CACHE 1;
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: token_supply_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
ALTER SEQUENCE public.token_supply_id_seq OWNED BY public.token_supply.id;
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: transactions; Type: TABLE; Schema: public; Owner: -
|
-- Name: transactions; Type: TABLE; Schema: public; Owner: -
|
||||||
--
|
--
|
||||||
@ -555,13 +523,6 @@ ALTER TABLE ONLY public.queued_storage ALTER COLUMN id SET DEFAULT nextval('publ
|
|||||||
ALTER TABLE ONLY public.receipts ALTER COLUMN id SET DEFAULT nextval('public.receipts_id_seq'::regclass);
|
ALTER TABLE ONLY public.receipts ALTER COLUMN id SET DEFAULT nextval('public.receipts_id_seq'::regclass);
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: token_supply id; Type: DEFAULT; Schema: public; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
ALTER TABLE ONLY public.token_supply ALTER COLUMN id SET DEFAULT nextval('public.token_supply_id_seq'::regclass);
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: transactions id; Type: DEFAULT; Schema: public; Owner: -
|
-- Name: transactions id; Type: DEFAULT; Schema: public; Owner: -
|
||||||
--
|
--
|
||||||
@ -754,14 +715,6 @@ ALTER TABLE ONLY public.receipts
|
|||||||
ADD CONSTRAINT blocks_fk FOREIGN KEY (block_id) REFERENCES public.blocks(id) ON DELETE CASCADE;
|
ADD CONSTRAINT blocks_fk FOREIGN KEY (block_id) REFERENCES public.blocks(id) ON DELETE CASCADE;
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: token_supply blocks_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
ALTER TABLE ONLY public.token_supply
|
|
||||||
ADD CONSTRAINT blocks_fk FOREIGN KEY (block_id) REFERENCES public.blocks(id) ON DELETE CASCADE;
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: checked_headers checked_headers_header_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
-- Name: checked_headers checked_headers_header_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||||
--
|
--
|
||||||
|
6
main.go
6
main.go
@ -4,8 +4,6 @@ import (
|
|||||||
"github.com/vulcanize/vulcanizedb/cmd"
|
"github.com/vulcanize/vulcanizedb/cmd"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"github.com/spf13/viper"
|
|
||||||
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"
|
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -19,9 +17,5 @@ func main() {
|
|||||||
log.Info("Failed to log to file, using default stderr")
|
log.Info("Failed to log to file, using default stderr")
|
||||||
}
|
}
|
||||||
|
|
||||||
tracer.Start(tracer.WithServiceName(viper.GetString("datadog.name")))
|
|
||||||
|
|
||||||
cmd.Execute()
|
cmd.Execute()
|
||||||
|
|
||||||
defer tracer.Stop()
|
|
||||||
}
|
}
|
||||||
|
@ -95,10 +95,13 @@ func NewTestDB(node core.Node) *postgres.DB {
|
|||||||
|
|
||||||
func CleanTestDB(db *postgres.DB) {
|
func CleanTestDB(db *postgres.DB) {
|
||||||
db.MustExec("DELETE FROM blocks")
|
db.MustExec("DELETE FROM blocks")
|
||||||
db.MustExec("DELETE FROM headers")
|
|
||||||
db.MustExec("DELETE FROM checked_headers")
|
db.MustExec("DELETE FROM checked_headers")
|
||||||
|
// can't delete from eth_nodes since this function is called after the required eth_node is persisted
|
||||||
|
db.MustExec("DELETE FROM goose_db_version")
|
||||||
|
db.MustExec("DELETE FROM headers")
|
||||||
db.MustExec("DELETE FROM log_filters")
|
db.MustExec("DELETE FROM log_filters")
|
||||||
db.MustExec("DELETE FROM logs")
|
db.MustExec("DELETE FROM logs")
|
||||||
|
db.MustExec("DELETE FROM queued_storage")
|
||||||
db.MustExec("DELETE FROM receipts")
|
db.MustExec("DELETE FROM receipts")
|
||||||
db.MustExec("DELETE FROM transactions")
|
db.MustExec("DELETE FROM transactions")
|
||||||
db.MustExec("DELETE FROM watched_contracts")
|
db.MustExec("DELETE FROM watched_contracts")
|
||||||
|
Loading…
Reference in New Issue
Block a user