-
Notifications
You must be signed in to change notification settings - Fork 0
/
rm.go
70 lines (55 loc) · 1.92 KB
/
rm.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package rm
import (
"github.com/macinnir/dvc/core/lib"
"go.uber.org/zap"
)
const CommandName = "rm"
// Rm removes an object from the database
// dvc rm [table]
func Cmd(logger *zap.Logger, config *lib.Config, args []string) error {
return nil
// if len(args) > 0 && args[0] == "help" {
// helpRm()
// return
// }
// database := c.loadDatabase()
// reader := bufio.NewReader(os.Stdin)
// sql := ""
// tableName := ""
// if len(args) > 0 {
// tableName = args[0]
// } else {
// tableName = lib.ReadCliInput(reader, "Table Name:")
// if _, ok := database.Tables[tableName]; !ok {
// fmt.Printf("Table `%s` does not exist.", tableName)
// return
// }
// }
// tableOrColumn := lib.ReadCliInput(reader, fmt.Sprintf("Drop the (t)able `%s` or select a (c)olumn?", tableName))
// if tableOrColumn == "t" {
// sql = fmt.Sprintf("DROP TABLE `%s`", tableName)
// } else if tableOrColumn == "c" {
// columnName := lib.ReadCliInput(reader, fmt.Sprintf("`%s`.Column:", tableName))
// if _, ok := database.Tables[tableName].Columns[columnName]; !ok {
// fmt.Printf("Column `%s`.`%s` doesn't exist.", tableName, columnName)
// return
// }
// sql = fmt.Sprintf("ALTER TABLE `%s` DROP COLUMN `%s`", tableName, columnName)
// } else {
// fmt.Println("Invalid entry")
// return
// }
// fmt.Print("\n------------------------------------------------------\n")
// fmt.Print("--------------------- REVIEW -------------------------\n")
// fmt.Print("------------------------------------------------------\n")
// fmt.Println(sql)
// fmt.Print("\n------------------------------------------------------\n")
// if lib.ReadCliInput(reader, "Are you sure want to execute the above SQL (Y/n)?") == "Y" {
// // Apply the change
// connector, _ := connectorFactory(c.Config.DatabaseType, c.Config)
// x := lib.NewExecutor(c.Config, connector)
// x.RunSQL(sql)
// // Import the schema
// c.Import([]string{})
// }
}