Skip to content

Commit

Permalink
db seed supports args
Browse files Browse the repository at this point in the history
  • Loading branch information
hosseinmirzapur committed Jan 5, 2024
1 parent ae59643 commit cdddadc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
8 changes: 2 additions & 6 deletions commands/db_seed_command.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package commands

import (
"strings"

"github.com/goravel/framework/contracts/console"
"github.com/goravel/framework/contracts/console/command"
"github.com/goravel/prisma/helpers"
"github.com/steebchen/prisma-client-go/cli"
)

Expand Down Expand Up @@ -33,8 +32,5 @@ func (receiver *DBSeedCommand) Extend() command.Extend {

// Handle Execute the console command
func (r *DBSeedCommand) Handle(ctx console.Context) error {
args := ctx.Argument(0)
cliCmd := append([]string{"db", "push"}, strings.Split(args, " ")...)
return cli.Run(cliCmd, true)

return cli.Run(helpers.Commands([]string{"db", "push"}, ctx.Arguments()...), true)
}
2 changes: 1 addition & 1 deletion commands/db_seed_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestDBSeedCommand(t *testing.T) {
defer removePrisma()

// test on user model
mockCtx.On("Argument", 0).Return("")
mockCtx.On("Arguments").Return([]string{""})
assert.Nil(t, dbsc.Handle(mockCtx))

}

0 comments on commit cdddadc

Please sign in to comment.