Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Commit

Permalink
adding instructions for --force-migrations (#1144)
Browse files Browse the repository at this point in the history
  • Loading branch information
paganotoni authored and markbates committed Jul 10, 2018
1 parent 5165618 commit c8dd1d8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions buffalo/cmd/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,12 @@ var forceMigrations = false

func init() {
decorate("test", testCmd)
testCmd.Flags().BoolVarP(&forceMigrations, "force-migrations", "m", false, "skips loading the schema and instead runs migrations before running tests")

RootCmd.AddCommand(testCmd)
}

var testCmd = &cobra.Command{
Use: "test",
Short: "Runs the tests for your Buffalo app",
Short: "Runs the tests for your Buffalo app. Use --force-migrations if you want to skip schema load.",
DisableFlagParsing: true,
RunE: func(c *cobra.Command, args []string) error {
os.Setenv("GO_ENV", "test")
Expand All @@ -52,6 +50,7 @@ var testCmd = &cobra.Command{
return errors.WithStack(err)
}

forceMigrations = strings.Contains(strings.Join(args, ""), "--force-migrations")
if forceMigrations {
fm, err := pop.NewFileMigrator("./migrations", test)

Expand Down Expand Up @@ -108,6 +107,7 @@ func testRunner(args []string) error {
var query string
cargs := []string{}
pargs := []string{}

var larg string
for i, a := range args {
switch a {
Expand Down

0 comments on commit c8dd1d8

Please sign in to comment.