| 65 | } |
| 66 | |
| 67 | func dropDatabase(dbName string) error { |
| 68 | config := util.GetConfig() |
| 69 | databaseType := config.GetString("database/type", "mysql") |
| 70 | databaseConnection := os.Getenv("DATABASE_CONNECTION") |
| 71 | if databaseConnection == "" { |
| 72 | databaseConnection = config.GetString("database/connection", "") |
| 73 | } |
| 74 | db, err := sql.Open(databaseType, databaseConnection) |
| 75 | if err != nil { |
| 76 | return nil |
| 77 | } |
| 78 | defer db.Close() |
| 79 | _, err = db.Exec("drop database " + dbName) |
| 80 | if err != nil { |
| 81 | return nil |
| 82 | } |
| 83 | return nil |
| 84 | } |
| 85 | |
| 86 | func gohanGenerate(c *cli.Context) { |
| 87 | path := c.String("output") |