MCPcopy
hub / github.com/hasura/graphql-engine / Create

Method Create

cli/migrate/cmd/commands.go:66–95  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

64}
65
66func (c *CreateOptions) Create() error {
67 var op errors.Op = "cmd.CreateOptions.Create"
68 path := filepath.Join(c.Directory, fmt.Sprintf("%s_%s", c.Version, c.Name))
69 err := os.MkdirAll(path, os.ModePerm)
70 if err != nil {
71 return errors.E(op, err)
72 }
73
74 // Check if data has been set in one of the files
75 if c.SQLUp == nil && c.SQLDown == nil {
76 return errors.E(op, "none of the files has been set with data")
77 }
78
79 if c.SQLUp != nil {
80 // Create SQLUp
81 err = createFile(filepath.Join(path, "up.sql"), c.SQLUp)
82 if err != nil {
83 return errors.E(op, err)
84 }
85 }
86
87 if c.SQLDown != nil {
88 // Create SQLDown
89 err = createFile(filepath.Join(path, "down.sql"), c.SQLDown)
90 if err != nil {
91 return errors.E(op, err)
92 }
93 }
94 return nil
95}
96
97func (c *CreateOptions) Delete() error {
98 var op errors.Op = "cmd.CreateOptions.Delete"

Callers 12

createFileFunction · 0.45
SquashCmdFunction · 0.45
MigrateAPIFunction · 0.45
runMethod · 0.45
runMethod · 0.45
genReSTTreeCustomFunction · 0.45
genMarkdownXTreeCustomFunction · 0.45
seed_apply_test.goFile · 0.45
copyFileFunction · 0.45
FSCopyFileFunction · 0.45
CopyFileFunction · 0.45
CopyFileAferoFunction · 0.45

Calls 1

createFileFunction · 0.85

Tested by

no test coverage detected