From 11cbb597471127c1b29e78e6cad0a1a4d93ea24c Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Thu, 17 May 2018 12:40:40 -0700 Subject: Renaming platform binary to mattermost. (#8801) --- cmd/commands/reset.go | 54 --------------------------------------------------- 1 file changed, 54 deletions(-) delete mode 100644 cmd/commands/reset.go (limited to 'cmd/commands/reset.go') 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 -} -- cgit v1.2.3-1-g7c22