From 19f9b9c1ea8919daf85e749a0cc35375587bcc15 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 10 May 2018 12:11:19 -0700 Subject: dummy data and postgres notes --- golang/cmd/fatcatd/reinit.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'golang/cmd') diff --git a/golang/cmd/fatcatd/reinit.go b/golang/cmd/fatcatd/reinit.go index b7cfa468..60726df0 100644 --- a/golang/cmd/fatcatd/reinit.go +++ b/golang/cmd/fatcatd/reinit.go @@ -22,12 +22,12 @@ func main_reinit() { box := packr.NewBox("../../sql") sql_schema, err := box.MustString("fatcat-schema.sql") if err != nil { - log.Panicf("finding SQL file: {}", err) + log.Panicf("finding SQL file: %v", err) } db_options, err := pg.ParseURL(viper.GetString("db_url")) if err != nil { - log.Panicf("parsing DB string: {}", err) + log.Panicf("parsing DB string: %v", err) } db := pg.Connect(db_options) defer db.Close() @@ -35,7 +35,16 @@ func main_reinit() { log.Info("Starting load...") _, err = db.Exec(sql_schema) if err != nil { - log.Fatalf("Error loading SQL: {}", err) + log.Fatalf("Error loading SQL: %v", err) + } + log.Info("Loading dummy data...") + sql_dummy, err := box.MustString("dummy-data.sql") + if err != nil { + log.Panicf("finding SQL file: %v", err) + } + _, err = db.Exec(sql_dummy) + if err != nil { + log.Fatalf("Error loading SQL: %v", err) } log.Info("Success!") -- cgit v1.2.3