summaryrefslogtreecommitdiffstats
path: root/cmd/commands/reset.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2018-05-17 12:40:40 -0700
committerGitHub <noreply@github.com>2018-05-17 12:40:40 -0700
commit11cbb597471127c1b29e78e6cad0a1a4d93ea24c (patch)
tree0eceb950872c7234348f0b41d4492073908840d0 /cmd/commands/reset.go
parent1f6c271b3bedd6656ae7155714423b1b39a669c1 (diff)
downloadchat-11cbb597471127c1b29e78e6cad0a1a4d93ea24c.tar.gz
chat-11cbb597471127c1b29e78e6cad0a1a4d93ea24c.tar.bz2
chat-11cbb597471127c1b29e78e6cad0a1a4d93ea24c.zip
Renaming platform binary to mattermost. (#8801)
Diffstat (limited to 'cmd/commands/reset.go')
-rw-r--r--cmd/commands/reset.go54
1 files changed, 0 insertions, 54 deletions
diff --git a/cmd/commands/reset.go b/cmd/commands/reset.go
deleted file mode 100644
index 15222acae..000000000
--- a/cmd/commands/reset.go
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-package commands
-
-import (
- "errors"
- "fmt"
-
- "github.com/mattermost/mattermost-server/cmd"
- "github.com/spf13/cobra"
-)
-
-var ResetCmd = &cobra.Command{
- Use: "reset",
- Short: "Reset the database to initial state",
- Long: "Completely erases the database causing the loss of all data. This will reset Mattermost to its initial state.",
- RunE: resetCmdF,
-}
-
-func init() {
- ResetCmd.Flags().Bool("confirm", false, "Confirm you really want to delete everything and a DB backup has been performed.")
-
- cmd.RootCmd.AddCommand(ResetCmd)
-}
-
-func resetCmdF(command *cobra.Command, args []string) error {
- a, err := cmd.InitDBCommandContextCobra(command)
- if err != nil {
- return err
- }
- defer a.Shutdown()
-
- confirmFlag, _ := command.Flags().GetBool("confirm")
- if !confirmFlag {
- var confirm string
- cmd.CommandPrettyPrintln("Have you performed a database backup? (YES/NO): ")
- fmt.Scanln(&confirm)
-
- if confirm != "YES" {
- return errors.New("ABORTED: You did not answer YES exactly, in all capitals.")
- }
- cmd.CommandPrettyPrintln("Are you sure you want to delete everything? All data will be permanently deleted? (YES/NO): ")
- fmt.Scanln(&confirm)
- if confirm != "YES" {
- return errors.New("ABORTED: You did not answer YES exactly, in all capitals.")
- }
- }
-
- a.Srv.Store.DropAllTables()
- cmd.CommandPrettyPrintln("Database successfully reset")
-
- return nil
-}