From 5eff2618ed7bacb1a8a648d517ca57e08531ac47 Mon Sep 17 00:00:00 2001 From: Rob Mulholand Date: Fri, 8 Mar 2019 11:34:06 -0600 Subject: [PATCH] Assorted cleanups - Remove DataDog - Remove token_supply table - Drop from more tables when cleaning DB for tests --- README.md | 1 - cmd/root.go | 2 - ...ble.sql => 00042_create_headers_table.sql} | 0 .../00042_create_token_supply_table.sql | 14 ----- ...=> 00043_create_checked_headers_table.sql} | 0 ...ge.sql => 00044_create_queued_storage.sql} | 0 db/schema.sql | 51 +------------------ main.go | 6 --- test_config/test_config.go | 5 +- 9 files changed, 6 insertions(+), 73 deletions(-) rename db/migrations/{00043_create_headers_table.sql => 00042_create_headers_table.sql} (100%) delete mode 100644 db/migrations/00042_create_token_supply_table.sql rename db/migrations/{00044_create_checked_headers_table.sql => 00043_create_checked_headers_table.sql} (100%) rename db/migrations/{00045_create_queued_storage.sql => 00044_create_queued_storage.sql} (100%) diff --git a/README.md b/README.md index 6a22b574..cb22e0c8 100644 --- a/README.md +++ b/README.md @@ -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: `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). diff --git a/cmd/root.go b/cmd/root.go index 4b73bf91..e88a025d 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -94,7 +94,6 @@ func init() { rootCmd.PersistentFlags().String("database-password", "", "database password") rootCmd.PersistentFlags().String("client-ipcPath", "", "location of geth.ipc file") 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("exporter-name", "exporter", "name of exporter plugin") @@ -105,7 +104,6 @@ func init() { viper.BindPFlag("database.password", rootCmd.PersistentFlags().Lookup("database-password")) viper.BindPFlag("client.ipcPath", rootCmd.PersistentFlags().Lookup("client-ipcPath")) 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("exporter.fileName", rootCmd.PersistentFlags().Lookup("exporter-name")) } diff --git a/db/migrations/00043_create_headers_table.sql b/db/migrations/00042_create_headers_table.sql similarity index 100% rename from db/migrations/00043_create_headers_table.sql rename to db/migrations/00042_create_headers_table.sql diff --git a/db/migrations/00042_create_token_supply_table.sql b/db/migrations/00042_create_token_supply_table.sql deleted file mode 100644 index 5caf36fb..00000000 --- a/db/migrations/00042_create_token_supply_table.sql +++ /dev/null @@ -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; diff --git a/db/migrations/00044_create_checked_headers_table.sql b/db/migrations/00043_create_checked_headers_table.sql similarity index 100% rename from db/migrations/00044_create_checked_headers_table.sql rename to db/migrations/00043_create_checked_headers_table.sql diff --git a/db/migrations/00045_create_queued_storage.sql b/db/migrations/00044_create_queued_storage.sql similarity index 100% rename from db/migrations/00045_create_queued_storage.sql rename to db/migrations/00044_create_queued_storage.sql diff --git a/db/schema.sql b/db/schema.sql index 963ebf5c..2501592a 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -2,8 +2,8 @@ -- PostgreSQL database dump -- --- Dumped from database version 10.5 --- Dumped by pg_dump version 10.5 +-- Dumped from database version 10.6 +-- Dumped by pg_dump version 10.6 SET statement_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; --- --- 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: - -- @@ -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); --- --- 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: - -- @@ -754,14 +715,6 @@ ALTER TABLE ONLY public.receipts 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: - -- diff --git a/main.go b/main.go index e376b631..bf9b2677 100644 --- a/main.go +++ b/main.go @@ -4,8 +4,6 @@ import ( "github.com/vulcanize/vulcanizedb/cmd" log "github.com/sirupsen/logrus" - "github.com/spf13/viper" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" "os" ) @@ -19,9 +17,5 @@ func main() { log.Info("Failed to log to file, using default stderr") } - tracer.Start(tracer.WithServiceName(viper.GetString("datadog.name"))) - cmd.Execute() - - defer tracer.Stop() } diff --git a/test_config/test_config.go b/test_config/test_config.go index b6a323d4..513a315a 100644 --- a/test_config/test_config.go +++ b/test_config/test_config.go @@ -95,10 +95,13 @@ func NewTestDB(node core.Node) *postgres.DB { func CleanTestDB(db *postgres.DB) { db.MustExec("DELETE FROM blocks") - db.MustExec("DELETE FROM 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 logs") + db.MustExec("DELETE FROM queued_storage") db.MustExec("DELETE FROM receipts") db.MustExec("DELETE FROM transactions") db.MustExec("DELETE FROM watched_contracts")