aboutsummaryrefslogtreecommitdiffstats
path: root/golang/cmd/fatcatd/reinit.go
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-05-26 16:42:17 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-05-26 16:42:19 -0700
commit82f8b4d838de3fb8eda5db9b23c5bc48ab281f9e (patch)
tree2b684049829c72fbdd4289535b18a19b884f377b /golang/cmd/fatcatd/reinit.go
parent9b3e52e813bbd9dc9b1771ca2c63e33d93048e97 (diff)
downloadfatcat-82f8b4d838de3fb8eda5db9b23c5bc48ab281f9e.tar.gz
fatcat-82f8b4d838de3fb8eda5db9b23c5bc48ab281f9e.zip
remove golang API server
Not following that path; this is to prevent future confusion. All code is still in version control.
Diffstat (limited to 'golang/cmd/fatcatd/reinit.go')
-rw-r--r--golang/cmd/fatcatd/reinit.go51
1 files changed, 0 insertions, 51 deletions
diff --git a/golang/cmd/fatcatd/reinit.go b/golang/cmd/fatcatd/reinit.go
deleted file mode 100644
index 60726df0..00000000
--- a/golang/cmd/fatcatd/reinit.go
+++ /dev/null
@@ -1,51 +0,0 @@
-
-package main
-
-import (
- "github.com/spf13/viper"
- log "github.com/sirupsen/logrus"
- "github.com/go-pg/pg"
- "github.com/spf13/cobra"
- "github.com/gobuffalo/packr"
-)
-
-var reinitCmd = &cobra.Command{
- Use: "reinit [options]",
- Short: "Reset database schema",
- Run: func(cmd *cobra.Command, args[] string) {
- main_reinit()
- },
-}
-
-func main_reinit() {
-
- box := packr.NewBox("../../sql")
- sql_schema, err := box.MustString("fatcat-schema.sql")
- if err != nil {
- log.Panicf("finding SQL file: %v", err)
- }
-
- db_options, err := pg.ParseURL(viper.GetString("db_url"))
- if err != nil {
- log.Panicf("parsing DB string: %v", err)
- }
- db := pg.Connect(db_options)
- defer db.Close()
-
- log.Info("Starting load...")
- _, err = db.Exec(sql_schema)
- if err != nil {
- 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!")
-
-}