forked from gobuffalo/pop
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
161 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/markbates/pop/soda/cmd/schema" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
// schemaCmd represents the schema command | ||
var schemaCmd = &cobra.Command{ | ||
Use: "schema", | ||
Short: "A brief description of your command", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
// TODO: Work your own magic here | ||
fmt.Println("schema called") | ||
}, | ||
} | ||
|
||
func init() { | ||
schemaCmd.AddCommand(schema.LoadCmd) | ||
schemaCmd.AddCommand(schema.DumpCmd) | ||
RootCmd.AddCommand(schemaCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package schema | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/markbates/pop" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var env string | ||
var DumpCmd = &cobra.Command{ | ||
Use: "dump", | ||
Short: "A brief description of your command", | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
c, err := pop.Connect(env) | ||
if err != nil { | ||
return err | ||
} | ||
err = c.Dialect.DumpSchema(os.Stdout) | ||
if err != nil { | ||
return err | ||
} | ||
return nil | ||
}, | ||
} | ||
|
||
func init() { | ||
DumpCmd.Flags().StringVarP(&env, "env", "e", "development", "The environment you want to run schema against. Will use $GO_ENV if set.") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package schema | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/spf13/cobra" | ||
) | ||
|
||
// schema/loadCmd represents the schema/load command | ||
var LoadCmd = &cobra.Command{ | ||
Use: "load", | ||
Short: "A brief description of your command", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
// TODO: Work your own magic here | ||
fmt.Println("schema/load called") | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters