diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2018-05-10 12:11:19 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2018-05-10 12:11:19 -0700 |
commit | 19f9b9c1ea8919daf85e749a0cc35375587bcc15 (patch) | |
tree | 85cf7cf8cafade0ba2551ef2373755591fd7da92 /golang/cmd/fatcatd/reinit.go | |
parent | b9200623b0be3c8b663c1000b63c3ab581b7d34b (diff) | |
download | fatcat-19f9b9c1ea8919daf85e749a0cc35375587bcc15.tar.gz fatcat-19f9b9c1ea8919daf85e749a0cc35375587bcc15.zip |
dummy data and postgres notes
Diffstat (limited to 'golang/cmd/fatcatd/reinit.go')
-rw-r--r-- | golang/cmd/fatcatd/reinit.go | 15 |
1 files changed, 12 insertions, 3 deletions
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!") |