From 90425fd412643b725d2ccf99a3ea8f1847b412a4 Mon Sep 17 00:00:00 2001 From: hosseinmirzapur Date: Tue, 2 Jan 2024 03:17:47 +0330 Subject: [PATCH 1/5] support for prisma go client --- database/console/prisma/db_exec_command.go | 40 ++++++++++++ .../console/prisma/db_exec_command_test.go | 29 +++++++++ database/console/prisma/db_pull_command.go | 39 ++++++++++++ .../console/prisma/db_pull_command_test.go | 29 +++++++++ database/console/prisma/db_push_command.go | 40 ++++++++++++ .../console/prisma/db_push_command_test.go | 26 ++++++++ database/console/prisma/db_seed_command.go | 40 ++++++++++++ .../console/prisma/db_seed_command_test.go | 26 ++++++++ database/console/prisma/debug_command.go | 35 +++++++++++ database/console/prisma/debug_command_test.go | 22 +++++++ database/console/prisma/format_command.go | 35 +++++++++++ .../console/prisma/format_command_test.go | 25 ++++++++ database/console/prisma/generate_command.go | 40 ++++++++++++ .../console/prisma/generate_command_test.go | 25 ++++++++ database/console/prisma/init_command.go | 41 ++++++++++++ database/console/prisma/init_command_test.go | 63 +++++++++++++++++++ .../console/prisma/migrate_deploy_command.go | 1 + .../console/prisma/migrate_dev_command.go | 1 + .../console/prisma/migrate_reset_command.go | 1 + .../console/prisma/migrate_status_command.go | 1 + database/console/prisma/studio_command.go | 1 + database/console/prisma/validate_command.go | 1 + database/console/prisma/version_command.go | 1 + go.mod | 6 +- go.sum | 29 +++++++++ 25 files changed, 596 insertions(+), 1 deletion(-) create mode 100644 database/console/prisma/db_exec_command.go create mode 100644 database/console/prisma/db_exec_command_test.go create mode 100644 database/console/prisma/db_pull_command.go create mode 100644 database/console/prisma/db_pull_command_test.go create mode 100644 database/console/prisma/db_push_command.go create mode 100644 database/console/prisma/db_push_command_test.go create mode 100644 database/console/prisma/db_seed_command.go create mode 100644 database/console/prisma/db_seed_command_test.go create mode 100644 database/console/prisma/debug_command.go create mode 100644 database/console/prisma/debug_command_test.go create mode 100644 database/console/prisma/format_command.go create mode 100644 database/console/prisma/format_command_test.go create mode 100644 database/console/prisma/generate_command.go create mode 100644 database/console/prisma/generate_command_test.go create mode 100644 database/console/prisma/init_command.go create mode 100644 database/console/prisma/init_command_test.go create mode 100644 database/console/prisma/migrate_deploy_command.go create mode 100644 database/console/prisma/migrate_dev_command.go create mode 100644 database/console/prisma/migrate_reset_command.go create mode 100644 database/console/prisma/migrate_status_command.go create mode 100644 database/console/prisma/studio_command.go create mode 100644 database/console/prisma/validate_command.go create mode 100644 database/console/prisma/version_command.go diff --git a/database/console/prisma/db_exec_command.go b/database/console/prisma/db_exec_command.go new file mode 100644 index 000000000..dde4cb953 --- /dev/null +++ b/database/console/prisma/db_exec_command.go @@ -0,0 +1,40 @@ +package prisma + +import ( + "strings" + + "github.com/goravel/framework/contracts/console" + "github.com/goravel/framework/contracts/console/command" + "github.com/steebchen/prisma-client-go/cli" +) + +type DBExecCommand struct{} + +func NewDBExecCommand() *DBExecCommand { + return &DBExecCommand{} +} + +// Signature The name and signature of the console command. +func (receiver *DBExecCommand) Signature() string { + return "prisma:db:exec" +} + +// Description The console command description. +func (receiver *DBExecCommand) Description() string { + return "🏋️ Manage your database schema and lifecycle during development." +} + +// Extend The console command extend. +func (receiver *DBExecCommand) Extend() command.Extend { + return command.Extend{ + Category: "prisma", + } +} + +// Handle Execute the console command +func (r *DBExecCommand) Handle(ctx console.Context) error { + args := ctx.Argument(0) + cliCmds := append([]string{"db", "execute"}, strings.Split(args, " ")...) + return cli.Run(cliCmds, true) + +} diff --git a/database/console/prisma/db_exec_command_test.go b/database/console/prisma/db_exec_command_test.go new file mode 100644 index 000000000..804712aef --- /dev/null +++ b/database/console/prisma/db_exec_command_test.go @@ -0,0 +1,29 @@ +package prisma + +import ( + "testing" + + consolemocks "github.com/goravel/framework/mocks/console" + "github.com/stretchr/testify/assert" +) + +func TestDBExecCommand(t *testing.T) { + // make an instance of db exec command struct + dbec := &DBExecCommand{} + mockCtx := &consolemocks.Context{} + + // no args + mockCtx.On("Argument", 0).Return("").Once() + assert.Error(t, dbec.Handle(mockCtx)) + + // no --file + mockCtx.On("Argument", 0).Return("--file").Once() + assert.Error(t, dbec.Handle(mockCtx)) + + // --stdin without sql in stdin + mockCtx.On("Argument", 0).Return("--stdin").Once() + assert.Error(t, dbec.Handle(mockCtx)) + + mockCtx.On("Argument", 0).Return("-h").Once() + assert.Nil(t, dbec.Handle(mockCtx)) +} diff --git a/database/console/prisma/db_pull_command.go b/database/console/prisma/db_pull_command.go new file mode 100644 index 000000000..68f013873 --- /dev/null +++ b/database/console/prisma/db_pull_command.go @@ -0,0 +1,39 @@ +package prisma + +import ( + "strings" + + "github.com/goravel/framework/contracts/console" + "github.com/goravel/framework/contracts/console/command" + "github.com/steebchen/prisma-client-go/cli" +) + +type DBPullCommand struct{} + +func NewDBPullCommand() *DBPullCommand { + return &DBPullCommand{} +} + +// Signature The name and signature of the console command. +func (receiver *DBPullCommand) Signature() string { + return "prisma:db:pull" +} + +// Description The console command description. +func (receiver *DBPullCommand) Description() string { + return "Pull the state from the database to the Prisma schema using introspection" +} + +// Extend The console command extend. +func (receiver *DBPullCommand) Extend() command.Extend { + return command.Extend{ + Category: "prisma", + } +} + +// Handle Execute the console command +func (r *DBPullCommand) Handle(ctx console.Context) error { + args := ctx.Argument(0) + cliCmd := append([]string{"db", "pull"}, strings.Split(args, " ")...) + return cli.Run(cliCmd, true) +} diff --git a/database/console/prisma/db_pull_command_test.go b/database/console/prisma/db_pull_command_test.go new file mode 100644 index 000000000..812cc52a0 --- /dev/null +++ b/database/console/prisma/db_pull_command_test.go @@ -0,0 +1,29 @@ +package prisma + +import ( + "testing" + + consolemocks "github.com/goravel/framework/mocks/console" + "github.com/stretchr/testify/assert" +) + +func TestDBPullCommand(t *testing.T) { + // make an instance of db pull command struct + dbpc := &DBPullCommand{} + mockCtx := &consolemocks.Context{} + + // init prisma + handleInitPrisma(mockCtx, t) + + // fill schema.prisma with data + fillPrismaSchema() + + // runs into error because it needs data in database + // otherwise there's no error + // used assert.Error to pass test + mockCtx.On("Argument", 0).Return("").Once() + assert.Error(t, dbpc.Handle(mockCtx)) + + // remove prima directory + removePrisma() +} diff --git a/database/console/prisma/db_push_command.go b/database/console/prisma/db_push_command.go new file mode 100644 index 000000000..58f1eb158 --- /dev/null +++ b/database/console/prisma/db_push_command.go @@ -0,0 +1,40 @@ +package prisma + +import ( + "strings" + + "github.com/goravel/framework/contracts/console" + "github.com/goravel/framework/contracts/console/command" + "github.com/steebchen/prisma-client-go/cli" +) + +type DBPushCommand struct{} + +func NewDBPushCommand() *DBPullCommand { + return &DBPullCommand{} +} + +// Signature The name and signature of the console command. +func (receiver *DBPushCommand) Signature() string { + return "prisma:db:pull" +} + +// Description The console command description. +func (receiver *DBPushCommand) Description() string { + return "🙌 Push the state from your Prisma schema to your database (no migrations change)" +} + +// Extend The console command extend. +func (receiver *DBPushCommand) Extend() command.Extend { + return command.Extend{ + Category: "prisma", + } +} + +// Handle Execute the console command +func (r *DBPushCommand) Handle(ctx console.Context) error { + args := ctx.Argument(0) + cliCmd := append([]string{"db", "push"}, strings.Split(args, " ")...) + return cli.Run(cliCmd, true) + +} diff --git a/database/console/prisma/db_push_command_test.go b/database/console/prisma/db_push_command_test.go new file mode 100644 index 000000000..482a8fd9b --- /dev/null +++ b/database/console/prisma/db_push_command_test.go @@ -0,0 +1,26 @@ +package prisma + +import ( + "testing" + + consolemocks "github.com/goravel/framework/mocks/console" + "github.com/stretchr/testify/assert" +) + +func TestDBPushCommand(t *testing.T) { + // make an instance of db pull command struct + dbpc := NewDBPushCommand() + mockCtx := &consolemocks.Context{} + + // init prisma project + handleInitPrisma(mockCtx, t) + + // fill schema.prisma with data + fillPrismaSchema() + + // requires at least one existing table at database to execute push + mockCtx.On("Argument", 0).Return("").Once() + assert.Error(t, dbpc.Handle(mockCtx)) + + removePrisma() +} diff --git a/database/console/prisma/db_seed_command.go b/database/console/prisma/db_seed_command.go new file mode 100644 index 000000000..ea87cdec1 --- /dev/null +++ b/database/console/prisma/db_seed_command.go @@ -0,0 +1,40 @@ +package prisma + +import ( + "strings" + + "github.com/goravel/framework/contracts/console" + "github.com/goravel/framework/contracts/console/command" + "github.com/steebchen/prisma-client-go/cli" +) + +type DBSeedCommand struct{} + +func NewDBSeedCommand() *DBSeedCommand { + return &DBSeedCommand{} +} + +// Signature The name and signature of the console command. +func (receiver *DBSeedCommand) Signature() string { + return "prisma:db:seed" +} + +// Description The console command description. +func (receiver *DBSeedCommand) Description() string { + return "🙌 Seed your database" +} + +// Extend The console command extend. +func (receiver *DBSeedCommand) Extend() command.Extend { + return command.Extend{ + Category: "prisma", + } +} + +// 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) + +} diff --git a/database/console/prisma/db_seed_command_test.go b/database/console/prisma/db_seed_command_test.go new file mode 100644 index 000000000..056c383d0 --- /dev/null +++ b/database/console/prisma/db_seed_command_test.go @@ -0,0 +1,26 @@ +package prisma + +import ( + "testing" + + consolemocks "github.com/goravel/framework/mocks/console" + "github.com/stretchr/testify/assert" +) + +func TestDBSeedCommand(t *testing.T) { + dbsc := NewDBSeedCommand() + mockCtx := &consolemocks.Context{} + + // init prisma before any test + handleInitPrisma(mockCtx, t) + + // fill schema.prisma with data + fillPrismaSchema() + + // test on user model + mockCtx.On("Argument", 0).Return("") + assert.Nil(t, dbsc.Handle(mockCtx)) + + // remove prisma after all test + removePrisma() +} diff --git a/database/console/prisma/debug_command.go b/database/console/prisma/debug_command.go new file mode 100644 index 000000000..523f33ed3 --- /dev/null +++ b/database/console/prisma/debug_command.go @@ -0,0 +1,35 @@ +package prisma + +import ( + "github.com/goravel/framework/contracts/console" + "github.com/goravel/framework/contracts/console/command" + "github.com/steebchen/prisma-client-go/cli" +) + +type DebugCommand struct{} + +func NewDebugCommand() *DebugCommand { + return &DebugCommand{} +} + +// Signature The name and signature of the console command. +func (receiver *DebugCommand) Signature() string { + return "prisma:debug" +} + +// Description The console command description. +func (receiver *DebugCommand) Description() string { + return "Print information helpful for debugging and bug reports" +} + +// Extend The console command extend. +func (receiver *DebugCommand) Extend() command.Extend { + return command.Extend{ + Category: "prisma", + } +} + +// Handle Execute the console command +func (r *DebugCommand) Handle(ctx console.Context) error { + return cli.Run([]string{"debug"}, true) +} diff --git a/database/console/prisma/debug_command_test.go b/database/console/prisma/debug_command_test.go new file mode 100644 index 000000000..5ee845b89 --- /dev/null +++ b/database/console/prisma/debug_command_test.go @@ -0,0 +1,22 @@ +package prisma + +import ( + "testing" + + consolemocks "github.com/goravel/framework/mocks/console" + "github.com/stretchr/testify/assert" +) + +func TestDebugCommand(t *testing.T) { + debugCmd := NewDebugCommand() + mockCtx := &consolemocks.Context{} + + // init prisma + handleInitPrisma(mockCtx, t) + + // check debug info + assert.Nil(t, debugCmd.Handle(mockCtx)) + + // remove prisma directory after tests + removePrisma() +} diff --git a/database/console/prisma/format_command.go b/database/console/prisma/format_command.go new file mode 100644 index 000000000..8bfe8ecef --- /dev/null +++ b/database/console/prisma/format_command.go @@ -0,0 +1,35 @@ +package prisma + +import ( + "github.com/goravel/framework/contracts/console" + "github.com/goravel/framework/contracts/console/command" + "github.com/steebchen/prisma-client-go/cli" +) + +type FormatCommand struct{} + +func NewFormatCommand() *FormatCommand { + return &FormatCommand{} +} + +// Signature The name and signature of the console command. +func (receiver *FormatCommand) Signature() string { + return "prisma:format" +} + +// Description The console command description. +func (receiver *FormatCommand) Description() string { + return "Format a Prisma schema" +} + +// Extend The console command extend. +func (receiver *FormatCommand) Extend() command.Extend { + return command.Extend{ + Category: "prisma", + } +} + +// Handle Execute the console command +func (r *FormatCommand) Handle(ctx console.Context) error { + return cli.Run([]string{"format"}, true) +} diff --git a/database/console/prisma/format_command_test.go b/database/console/prisma/format_command_test.go new file mode 100644 index 000000000..540b69ead --- /dev/null +++ b/database/console/prisma/format_command_test.go @@ -0,0 +1,25 @@ +package prisma + +import ( + "testing" + + consolemocks "github.com/goravel/framework/mocks/console" + "github.com/stretchr/testify/assert" +) + +func TestFormatCommand(t *testing.T) { + fmtCmd := NewFormatCommand() + ctx := &consolemocks.Context{} + + // init prisma project + handleInitPrisma(ctx, t) + + // fill schema.prisma with data + fillPrismaSchema() + + // formatting the prisma schema file has no error + assert.NoError(t, fmtCmd.Handle(ctx)) + + // remove prisma directory + removePrisma() +} diff --git a/database/console/prisma/generate_command.go b/database/console/prisma/generate_command.go new file mode 100644 index 000000000..cadd1526d --- /dev/null +++ b/database/console/prisma/generate_command.go @@ -0,0 +1,40 @@ +package prisma + +import ( + "strings" + + "github.com/goravel/framework/contracts/console" + "github.com/goravel/framework/contracts/console/command" + "github.com/steebchen/prisma-client-go/cli" +) + +type GenerateCommand struct{} + +func NewGenerateCommand() *GenerateCommand { + return &GenerateCommand{} +} + +// Signature The name and signature of the console command. +func (receiver *GenerateCommand) Signature() string { + return "prisma:generate" +} + +// Description The console command description. +func (receiver *GenerateCommand) Description() string { + return "Generate artifacts (e.g. Prisma Client)" +} + +// Extend The console command extend. +func (receiver *GenerateCommand) Extend() command.Extend { + return command.Extend{ + Category: "prisma", + } +} + +// Handle Execute the console command +func (r *GenerateCommand) Handle(ctx console.Context) error { + generateCmd := []string{"generate"} + generateCmd = append(generateCmd, strings.Split(ctx.Argument(0), " ")...) + + return cli.Run(generateCmd, true) +} diff --git a/database/console/prisma/generate_command_test.go b/database/console/prisma/generate_command_test.go new file mode 100644 index 000000000..49c296b1b --- /dev/null +++ b/database/console/prisma/generate_command_test.go @@ -0,0 +1,25 @@ +package prisma + +import ( + "testing" + + consolemocks "github.com/goravel/framework/mocks/console" + "github.com/stretchr/testify/assert" +) + +func TestGenerateCommand(t *testing.T) { + ctx := &consolemocks.Context{} + genCmd := NewGenerateCommand() + + // init a prisma project before tests + handleInitPrisma(ctx, t) + + // fill schema.prisma with data + fillPrismaSchema() + + // if database instance not running this passes + assert.Nil(t, genCmd.Handle(ctx)) + + // remove prisma folder + removePrisma() +} diff --git a/database/console/prisma/init_command.go b/database/console/prisma/init_command.go new file mode 100644 index 000000000..2ad388b47 --- /dev/null +++ b/database/console/prisma/init_command.go @@ -0,0 +1,41 @@ +package prisma + +import ( + "github.com/goravel/framework/contracts/console" + "github.com/goravel/framework/contracts/console/command" + "github.com/steebchen/prisma-client-go/cli" +) + +type InitCommand struct { +} + +func NewInitCommand() *InitCommand { + return &InitCommand{} +} + +// Signature The name and signature of the console command. +func (receiver *InitCommand) Signature() string { + return "prisma:init" +} + +// Description The console command description. +func (receiver *InitCommand) Description() string { + return "Set up a new Prisma project" +} + +// Extend The console command extend. +func (receiver *InitCommand) Extend() command.Extend { + return command.Extend{ + Category: "prisma", + } +} + +// Handle Execute the console command. +func (receiver *InitCommand) Handle(ctx console.Context) error { + cliCmds := []string{ + "init", "--generator-provider", ".", + "--datasource-provider", "sqlite", + "--url", "file:dev.db", + } + return cli.Run(cliCmds, true) +} diff --git a/database/console/prisma/init_command_test.go b/database/console/prisma/init_command_test.go new file mode 100644 index 000000000..fc0980ac7 --- /dev/null +++ b/database/console/prisma/init_command_test.go @@ -0,0 +1,63 @@ +package prisma + +import ( + "os" + "testing" + + "github.com/gookit/color" + consolemocks "github.com/goravel/framework/mocks/console" + "github.com/stretchr/testify/assert" +) + +func TestInitCommand(t *testing.T) { + mockCtx := &consolemocks.Context{} + + // init prisma project + handleInitPrisma(mockCtx, t) + + // check directories created + assert.DirExists(t, "prisma") + assert.FileExists(t, "prisma/schema.prisma") + assert.FileExists(t, ".env") + assert.FileExists(t, ".gitignore") + + // remove prisma directory + removePrisma() + +} + +func handleInitPrisma(ctx *consolemocks.Context, t *testing.T) { + ic := NewInitCommand() + + ctx.On("Argument", 0).Return("") + assert.NoError(t, ic.Handle(ctx)) + os.Create("prisma/dev.db") +} + +func removePrisma() { + os.RemoveAll("prisma") + os.Remove(".env") + os.Remove(".gitignore") +} + +func fillPrismaSchema() { + file, err := os.OpenFile("prisma/schema.prisma", os.O_APPEND|os.O_WRONLY, 0644) + if err != nil { + color.Redln("unable to open schema.prisma") + os.Exit(1) + } + defer file.Close() + + txt := ` + +model User { + id Int @id @default(autoincrement()) + email String @unique + name String? +} +` + if _, err = file.WriteString(txt); err != nil { + color.Redln("unable to write to schema.prisma") + os.Exit(1) + } +} diff --git a/database/console/prisma/migrate_deploy_command.go b/database/console/prisma/migrate_deploy_command.go new file mode 100644 index 000000000..cdd55b3c9 --- /dev/null +++ b/database/console/prisma/migrate_deploy_command.go @@ -0,0 +1 @@ +package prisma diff --git a/database/console/prisma/migrate_dev_command.go b/database/console/prisma/migrate_dev_command.go new file mode 100644 index 000000000..cdd55b3c9 --- /dev/null +++ b/database/console/prisma/migrate_dev_command.go @@ -0,0 +1 @@ +package prisma diff --git a/database/console/prisma/migrate_reset_command.go b/database/console/prisma/migrate_reset_command.go new file mode 100644 index 000000000..cdd55b3c9 --- /dev/null +++ b/database/console/prisma/migrate_reset_command.go @@ -0,0 +1 @@ +package prisma diff --git a/database/console/prisma/migrate_status_command.go b/database/console/prisma/migrate_status_command.go new file mode 100644 index 000000000..cdd55b3c9 --- /dev/null +++ b/database/console/prisma/migrate_status_command.go @@ -0,0 +1 @@ +package prisma diff --git a/database/console/prisma/studio_command.go b/database/console/prisma/studio_command.go new file mode 100644 index 000000000..cdd55b3c9 --- /dev/null +++ b/database/console/prisma/studio_command.go @@ -0,0 +1 @@ +package prisma diff --git a/database/console/prisma/validate_command.go b/database/console/prisma/validate_command.go new file mode 100644 index 000000000..cdd55b3c9 --- /dev/null +++ b/database/console/prisma/validate_command.go @@ -0,0 +1 @@ +package prisma diff --git a/database/console/prisma/version_command.go b/database/console/prisma/version_command.go new file mode 100644 index 000000000..cdd55b3c9 --- /dev/null +++ b/database/console/prisma/version_command.go @@ -0,0 +1 @@ +package prisma diff --git a/go.mod b/go.mod index 6db4b2151..fe9e299fb 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,8 @@ module github.com/goravel/framework -go 1.20 +go 1.21 + +toolchain go1.21.4 require ( github.com/RichardKnop/machinery/v2 v2.0.12-0.20231012204029-bdb94a90ca41 @@ -43,6 +45,8 @@ require ( gorm.io/plugin/dbresolver v1.5.0 ) +require github.com/steebchen/prisma-client-go v0.31.3 // indirect + require ( cloud.google.com/go v0.110.10 // indirect cloud.google.com/go/compute v1.23.3 // indirect diff --git a/go.sum b/go.sum index 744af5cd3..4c8ba420c 100644 --- a/go.sum +++ b/go.sum @@ -33,6 +33,7 @@ cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1 cloud.google.com/go/iam v1.1.5 h1:1jTsCu4bcsNsE4iiqNT5SHwrDRCfRmIaaaVFhRveTJI= cloud.google.com/go/iam v1.1.5/go.mod h1:rB6P/Ic3mykPbFio+vo7403drjlgvoWfYpJhMXEbzv8= cloud.google.com/go/kms v1.15.5 h1:pj1sRfut2eRbD9pFRjNnPNg/CzJPuQAzUujMIM1vVeM= +cloud.google.com/go/kms v1.15.5/go.mod h1:cU2H5jnp6G2TDpUGZyqTCoy1n16fbubHZjmVXSMtwDI= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= @@ -62,6 +63,7 @@ github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.0.0/go.mod h1: github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v0.8.0 h1:T028gtTPiYt/RMUfs8nVsAL7FDQrfLlrm/NnRG/zcC4= github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v0.8.0/go.mod h1:cw4zVQgBby0Z5f2v0itn6se2dDP17nTjbZFXW5uPyHA= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= +github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs= github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= github.com/Azure/go-autorest/autorest/adal v0.9.16 h1:P8An8Z9rH1ldbOLdFpxYorgOt2sywL9V24dAwWHPuGc= @@ -80,6 +82,7 @@ github.com/AzureAD/microsoft-authentication-library-for-go v1.1.0/go.mod h1:wP83 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= +github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/RichardKnop/logging v0.0.0-20190827224416-1a693bdd4fae h1:DcFpTQBYQ9Ct2d6sC7ol0/ynxc2pO1cpGUM+f4t5adg= github.com/RichardKnop/logging v0.0.0-20190827224416-1a693bdd4fae/go.mod h1:rJJ84PyA/Wlmw1hO+xTzV2wsSUon6J5ktg0g8BF2PuU= github.com/RichardKnop/machinery/v2 v2.0.12-0.20231012204029-bdb94a90ca41 h1:7fLtRodG39Hn6AKqKE+ejO0Jj9B8O9RQOto13lkoDac= @@ -95,9 +98,11 @@ github.com/brianvoe/gofakeit/v6 v6.26.3/go.mod h1:Xj58BMSnFqcn/fAQeSK+/PLtC5kSb7 github.com/bsm/ginkgo/v2 v2.5.0/go.mod h1:AiKlXPm7ItEHNc/2+OkrNG4E0ITzojb9/xWzvQ9XZ9w= github.com/bsm/ginkgo/v2 v2.7.0/go.mod h1:AiKlXPm7ItEHNc/2+OkrNG4E0ITzojb9/xWzvQ9XZ9w= github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs= +github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c= github.com/bsm/gomega v1.20.0/go.mod h1:JifAceMQ4crZIWYUKrlGcmbN3bqHogVTADMD2ATsbwk= github.com/bsm/gomega v1.26.0/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0= github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA= +github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0= github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM= github.com/bytedance/sonic v1.10.0-rc/go.mod h1:ElCzW+ufi8qKqNW0FY314xriJhyJhuoJ3gFZdAHF7NM= github.com/bytedance/sonic v1.10.2 h1:GQebETVBxYB7JGWJtLBi07OVzWwt+8dWA00gEVW2ZFE= @@ -129,12 +134,17 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8Yc github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= github.com/dhui/dktest v0.4.0 h1:z05UmuXZHO/bgj/ds2bGMBu8FI4WA+Ag/m3ghL+om7M= +github.com/dhui/dktest v0.4.0/go.mod h1:v/Dbz1LgCBOi2Uki2nUqLBGa83hWBGFMu5MrgMDCc78= github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= +github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= +github.com/docker/docker v24.0.7+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= +github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= +github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -144,6 +154,7 @@ github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5y github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= +github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= @@ -269,6 +280,7 @@ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -283,6 +295,7 @@ github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26 h1:Xim43kblpZXfIBQsbuBVKCudVG457BR2GZFIz3uw3hQ= +github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26/go.mod h1:dDKJzRmX4S37WGHujM7tX//fmj1uioxKzKxz3lo4HJo= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= @@ -351,6 +364,7 @@ github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHW github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= +github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/karrick/godirwalk v1.8.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaRPx4tDPEn4= @@ -371,12 +385,15 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxv github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lestrrat-go/envload v0.0.0-20180220234015-a3eb8ddeffcc h1:RKf14vYWi2ttpEmkA4aQ3j4u9dStX2t4M8UM6qqNsG8= +github.com/lestrrat-go/envload v0.0.0-20180220234015-a3eb8ddeffcc/go.mod h1:kopuH9ugFRkIXf3YoqHKyrJ9YfUFsckUU9S7B+XP+is= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= @@ -390,10 +407,12 @@ github.com/microsoft/go-mssqldb v1.6.0/go.mod h1:00mDtPbeQCRGC1HwOOR5K/gr30P1NcE github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= +github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/montanaflynn/stats v0.7.0/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= +github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= @@ -405,7 +424,9 @@ github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7J github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.16.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= +github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM= +github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= @@ -438,6 +459,7 @@ github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rotisserie/eris v0.5.4 h1:Il6IvLdAapsMhvuOahHWiBnl1G++Q0/L5UIkI5mARSk= github.com/rotisserie/eris v0.5.4/go.mod h1:Z/kgYTJiJtocxCbFfvRmO+QejApzG6zpyky9G1A4g9s= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -447,6 +469,7 @@ github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6ke github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= +github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= @@ -465,6 +488,8 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ= github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= +github.com/steebchen/prisma-client-go v0.31.3 h1:ubqSRFfPUTAHZijY/HqeTlKJWJpI3Lj4O338AqvqBeg= +github.com/steebchen/prisma-client-go v0.31.3/go.mod h1:ksKELgUZSn56rbAv1jlF8D7o8V6lis0Tc2LEgv2qNbs= github.com/streadway/amqp v1.0.0 h1:kuuDrUJFZL1QYL9hUNuCxNObNzB0bV/ZG5jV3RWAQgo= github.com/streadway/amqp v1.0.0/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -593,6 +618,7 @@ golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= +golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -727,6 +753,7 @@ golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= +golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -808,6 +835,7 @@ golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.16.1 h1:TLyB3WofjdOEepBHAU20JdNC1Zbg87elYofWYAY5oZA= +golang.org/x/tools v0.16.1/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -921,6 +949,7 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= From a999732c4a60dc5798f4de34ddbf542d6c98068f Mon Sep 17 00:00:00 2001 From: hosseinmirzapur Date: Tue, 2 Jan 2024 18:12:42 +0330 Subject: [PATCH 2/5] added migrate and validate commands --- .../console/prisma/db_pull_command_test.go | 3 +- .../console/prisma/db_push_command_test.go | 2 +- .../console/prisma/db_seed_command_test.go | 3 +- database/console/prisma/debug_command_test.go | 4 +- .../console/prisma/format_command_test.go | 4 +- .../console/prisma/generate_command_test.go | 4 +- database/console/prisma/init_command_test.go | 5 +-- .../console/prisma/migrate_deploy_command.go | 42 +++++++++++++++++++ .../prisma/migrate_deploy_command_test.go | 24 +++++++++++ .../console/prisma/migrate_dev_command.go | 42 +++++++++++++++++++ .../prisma/migrate_dev_command_test.go | 26 ++++++++++++ .../console/prisma/migrate_reset_command.go | 41 ++++++++++++++++++ .../prisma/migrate_reset_command_test.go | 34 +++++++++++++++ .../console/prisma/migrate_status_command.go | 41 ++++++++++++++++++ .../prisma/migrate_status_command_test.go | 27 ++++++++++++ database/console/prisma/studio_command.go | 1 - database/console/prisma/validate_command.go | 41 ++++++++++++++++++ .../console/prisma/validate_command_test.go | 24 +++++++++++ .../console/prisma/version_comand_test.go | 17 ++++++++ database/console/prisma/version_command.go | 41 ++++++++++++++++++ 20 files changed, 407 insertions(+), 19 deletions(-) create mode 100644 database/console/prisma/migrate_deploy_command_test.go create mode 100644 database/console/prisma/migrate_dev_command_test.go create mode 100644 database/console/prisma/migrate_reset_command_test.go create mode 100644 database/console/prisma/migrate_status_command_test.go delete mode 100644 database/console/prisma/studio_command.go create mode 100644 database/console/prisma/validate_command_test.go create mode 100644 database/console/prisma/version_comand_test.go diff --git a/database/console/prisma/db_pull_command_test.go b/database/console/prisma/db_pull_command_test.go index 812cc52a0..9fcaf49df 100644 --- a/database/console/prisma/db_pull_command_test.go +++ b/database/console/prisma/db_pull_command_test.go @@ -14,6 +14,7 @@ func TestDBPullCommand(t *testing.T) { // init prisma handleInitPrisma(mockCtx, t) + defer removePrisma() // fill schema.prisma with data fillPrismaSchema() @@ -24,6 +25,4 @@ func TestDBPullCommand(t *testing.T) { mockCtx.On("Argument", 0).Return("").Once() assert.Error(t, dbpc.Handle(mockCtx)) - // remove prima directory - removePrisma() } diff --git a/database/console/prisma/db_push_command_test.go b/database/console/prisma/db_push_command_test.go index 482a8fd9b..758561936 100644 --- a/database/console/prisma/db_push_command_test.go +++ b/database/console/prisma/db_push_command_test.go @@ -14,6 +14,7 @@ func TestDBPushCommand(t *testing.T) { // init prisma project handleInitPrisma(mockCtx, t) + defer removePrisma() // fill schema.prisma with data fillPrismaSchema() @@ -22,5 +23,4 @@ func TestDBPushCommand(t *testing.T) { mockCtx.On("Argument", 0).Return("").Once() assert.Error(t, dbpc.Handle(mockCtx)) - removePrisma() } diff --git a/database/console/prisma/db_seed_command_test.go b/database/console/prisma/db_seed_command_test.go index 056c383d0..753f3e2c0 100644 --- a/database/console/prisma/db_seed_command_test.go +++ b/database/console/prisma/db_seed_command_test.go @@ -16,11 +16,10 @@ func TestDBSeedCommand(t *testing.T) { // fill schema.prisma with data fillPrismaSchema() + defer removePrisma() // test on user model mockCtx.On("Argument", 0).Return("") assert.Nil(t, dbsc.Handle(mockCtx)) - // remove prisma after all test - removePrisma() } diff --git a/database/console/prisma/debug_command_test.go b/database/console/prisma/debug_command_test.go index 5ee845b89..c581835ea 100644 --- a/database/console/prisma/debug_command_test.go +++ b/database/console/prisma/debug_command_test.go @@ -13,10 +13,8 @@ func TestDebugCommand(t *testing.T) { // init prisma handleInitPrisma(mockCtx, t) + defer removePrisma() // check debug info assert.Nil(t, debugCmd.Handle(mockCtx)) - - // remove prisma directory after tests - removePrisma() } diff --git a/database/console/prisma/format_command_test.go b/database/console/prisma/format_command_test.go index 540b69ead..9584552d8 100644 --- a/database/console/prisma/format_command_test.go +++ b/database/console/prisma/format_command_test.go @@ -13,13 +13,11 @@ func TestFormatCommand(t *testing.T) { // init prisma project handleInitPrisma(ctx, t) + defer removePrisma() // fill schema.prisma with data fillPrismaSchema() // formatting the prisma schema file has no error assert.NoError(t, fmtCmd.Handle(ctx)) - - // remove prisma directory - removePrisma() } diff --git a/database/console/prisma/generate_command_test.go b/database/console/prisma/generate_command_test.go index 49c296b1b..dbe439e50 100644 --- a/database/console/prisma/generate_command_test.go +++ b/database/console/prisma/generate_command_test.go @@ -13,13 +13,11 @@ func TestGenerateCommand(t *testing.T) { // init a prisma project before tests handleInitPrisma(ctx, t) + defer removePrisma() // fill schema.prisma with data fillPrismaSchema() // if database instance not running this passes assert.Nil(t, genCmd.Handle(ctx)) - - // remove prisma folder - removePrisma() } diff --git a/database/console/prisma/init_command_test.go b/database/console/prisma/init_command_test.go index fc0980ac7..fcda406a7 100644 --- a/database/console/prisma/init_command_test.go +++ b/database/console/prisma/init_command_test.go @@ -14,16 +14,13 @@ func TestInitCommand(t *testing.T) { // init prisma project handleInitPrisma(mockCtx, t) + defer removePrisma() // check directories created assert.DirExists(t, "prisma") assert.FileExists(t, "prisma/schema.prisma") assert.FileExists(t, ".env") assert.FileExists(t, ".gitignore") - - // remove prisma directory - removePrisma() - } func handleInitPrisma(ctx *consolemocks.Context, t *testing.T) { diff --git a/database/console/prisma/migrate_deploy_command.go b/database/console/prisma/migrate_deploy_command.go index cdd55b3c9..41ca68ee0 100644 --- a/database/console/prisma/migrate_deploy_command.go +++ b/database/console/prisma/migrate_deploy_command.go @@ -1 +1,43 @@ package prisma + +import ( + "strings" + + "github.com/goravel/framework/contracts/console" + "github.com/goravel/framework/contracts/console/command" + "github.com/steebchen/prisma-client-go/cli" +) + +type MigrateDeployCommand struct { +} + +func NewMigrateDeployCommand() *MigrateDeployCommand { + return &MigrateDeployCommand{} +} + +// Signature The name and signature of the console command. +func (receiver *MigrateDeployCommand) Signature() string { + return "prisma:migrate:deploy" +} + +// Description The console command description. +func (receiver *MigrateDeployCommand) Description() string { + return "Apply pending migrations to update the database schema in production/staging" +} + +// Extend The console command extend. +func (receiver *MigrateDeployCommand) Extend() command.Extend { + return command.Extend{ + Category: "prisma", + } +} + +// Handle Execute the console command. +func (receiver *MigrateDeployCommand) Handle(ctx console.Context) error { + args := strings.Split(ctx.Argument(0), " ") + cliCmds := []string{ + "migrate", "deploy", + } + cliCmds = append(cliCmds, args...) + return cli.Run(cliCmds, true) +} diff --git a/database/console/prisma/migrate_deploy_command_test.go b/database/console/prisma/migrate_deploy_command_test.go new file mode 100644 index 000000000..8b9229339 --- /dev/null +++ b/database/console/prisma/migrate_deploy_command_test.go @@ -0,0 +1,24 @@ +package prisma + +import ( + "testing" + + consolemocks "github.com/goravel/framework/mocks/console" + "github.com/stretchr/testify/assert" +) + +func TestMigrateDeployCommand(t *testing.T) { + ctx := &consolemocks.Context{} + mdc := NewMigrateDeployCommand() + + // init prisma + handleInitPrisma(ctx, t) + defer removePrisma() + + // init prisma schema + fillPrismaSchema() + + // no args + ctx.On("Argument", 0).Return("").Once() + assert.Nil(t, mdc.Handle(ctx)) +} diff --git a/database/console/prisma/migrate_dev_command.go b/database/console/prisma/migrate_dev_command.go index cdd55b3c9..b1069de02 100644 --- a/database/console/prisma/migrate_dev_command.go +++ b/database/console/prisma/migrate_dev_command.go @@ -1 +1,43 @@ package prisma + +import ( + "strings" + + "github.com/goravel/framework/contracts/console" + "github.com/goravel/framework/contracts/console/command" + "github.com/steebchen/prisma-client-go/cli" +) + +type MigrateDevCommand struct{} + +func NewMigrateDevCommand() *MigrateDevCommand { + return &MigrateDevCommand{} +} + +// Signature The name and signature of the console command. +func (receiver *MigrateDevCommand) Signature() string { + return "prisma:migrate:dev" +} + +// Description The console command description. +func (receiver *MigrateDevCommand) Description() string { + return "🏋️ Create a migration from changes in Prisma schema, apply it to the database, trigger generators (e.g. Prisma Client)" +} + +// Extend The console command extend. +func (receiver *MigrateDevCommand) Extend() command.Extend { + return command.Extend{ + Category: "prisma", + } +} + +// Handle Execute the console command. +func (receiver *MigrateDevCommand) Handle(ctx console.Context) error { + args := strings.Split(ctx.Argument(0), " ") + cliCmds := []string{ + "migrate", "dev", + "--name", "init", + } + cliCmds = append(cliCmds, args...) + return cli.Run(cliCmds, true) +} diff --git a/database/console/prisma/migrate_dev_command_test.go b/database/console/prisma/migrate_dev_command_test.go new file mode 100644 index 000000000..056b9a6c4 --- /dev/null +++ b/database/console/prisma/migrate_dev_command_test.go @@ -0,0 +1,26 @@ +package prisma + +import ( + "testing" + + consolemocks "github.com/goravel/framework/mocks/console" + "github.com/stretchr/testify/assert" +) + +func TestMigrateDevCommand(t *testing.T) { + ctx := &consolemocks.Context{} + mdc := NewMigrateDevCommand() + + // init prisma + handleInitPrisma(ctx, t) + defer removePrisma() + + // fill prisma schema + fillPrismaSchema() + + // --name unspecified + ctx.On("Argument", 0).Return("") + assert.Nil(t, mdc.Handle(ctx)) + + assert.DirExists(t, "prisma/migrations") +} diff --git a/database/console/prisma/migrate_reset_command.go b/database/console/prisma/migrate_reset_command.go index cdd55b3c9..2eee8668f 100644 --- a/database/console/prisma/migrate_reset_command.go +++ b/database/console/prisma/migrate_reset_command.go @@ -1 +1,42 @@ package prisma + +import ( + "strings" + + "github.com/goravel/framework/contracts/console" + "github.com/goravel/framework/contracts/console/command" + "github.com/steebchen/prisma-client-go/cli" +) + +type MigrateResetCommand struct{} + +func NewMigrateResetCommand() *MigrateResetCommand { + return &MigrateResetCommand{} +} + +// Signature The name and signature of the console command. +func (receiver *MigrateResetCommand) Signature() string { + return "prisma:migrate:reset" +} + +// Description The console command description. +func (receiver *MigrateResetCommand) Description() string { + return "Reset your database and apply all migrations, all data will be lost" +} + +// Extend The console command extend. +func (receiver *MigrateResetCommand) Extend() command.Extend { + return command.Extend{ + Category: "prisma", + } +} + +// Handle Execute the console command. +func (receiver *MigrateResetCommand) Handle(ctx console.Context) error { + args := strings.Split(ctx.Argument(0), " ") + cliCmds := []string{ + "migrate", "reset", + } + cliCmds = append(cliCmds, args...) + return cli.Run(cliCmds, true) +} diff --git a/database/console/prisma/migrate_reset_command_test.go b/database/console/prisma/migrate_reset_command_test.go new file mode 100644 index 000000000..4cd92d4af --- /dev/null +++ b/database/console/prisma/migrate_reset_command_test.go @@ -0,0 +1,34 @@ +package prisma + +import ( + "testing" + + consolemocks "github.com/goravel/framework/mocks/console" + "github.com/stretchr/testify/assert" +) + +func TestMigrateResetCommand(t *testing.T) { + ctx := &consolemocks.Context{} + mdc := NewMigrateResetCommand() + + // init prisma + handleInitPrisma(ctx, t) + defer removePrisma() + + // fill prisma schema + fillPrismaSchema() + + // firstly migrate the schema + migrateDev(ctx) + + // reset command will fail because it requires user interaction to continue + // but passes as a assert.Error() test + ctx.On("Argument", 0).Return("").Once() + assert.Error(t, mdc.Handle(ctx)) +} + +func migrateDev(ctx *consolemocks.Context) { + md := NewMigrateDevCommand() + ctx.On("Argument", 0).Return("").Once() + md.Handle(ctx) +} diff --git a/database/console/prisma/migrate_status_command.go b/database/console/prisma/migrate_status_command.go index cdd55b3c9..6485ca703 100644 --- a/database/console/prisma/migrate_status_command.go +++ b/database/console/prisma/migrate_status_command.go @@ -1 +1,42 @@ package prisma + +import ( + "strings" + + "github.com/goravel/framework/contracts/console" + "github.com/goravel/framework/contracts/console/command" + "github.com/steebchen/prisma-client-go/cli" +) + +type MigrateStatusCommand struct{} + +func NewMigrateStatusCommand() *MigrateStatusCommand { + return &MigrateStatusCommand{} +} + +// Signature The name and signature of the console command. +func (receiver *MigrateStatusCommand) Signature() string { + return "prisma:migrate:status" +} + +// Description The console command description. +func (receiver *MigrateStatusCommand) Description() string { + return "Check the status of your database migrations" +} + +// Extend The console command extend. +func (receiver *MigrateStatusCommand) Extend() command.Extend { + return command.Extend{ + Category: "prisma", + } +} + +// Handle Execute the console command. +func (receiver *MigrateStatusCommand) Handle(ctx console.Context) error { + args := strings.Split(ctx.Argument(0), " ") + cliCmds := []string{ + "migrate", "status", + } + cliCmds = append(cliCmds, args...) + return cli.Run(cliCmds, true) +} diff --git a/database/console/prisma/migrate_status_command_test.go b/database/console/prisma/migrate_status_command_test.go new file mode 100644 index 000000000..0ffd199a7 --- /dev/null +++ b/database/console/prisma/migrate_status_command_test.go @@ -0,0 +1,27 @@ +package prisma + +import ( + "testing" + + consolemocks "github.com/goravel/framework/mocks/console" + "github.com/stretchr/testify/assert" +) + +func TestMigrateStatusCommand(t *testing.T) { + ctx := &consolemocks.Context{} + mdc := NewMigrateStatusCommand() + + // init prisma + handleInitPrisma(ctx, t) + defer removePrisma() + + // fill prisma schema + fillPrismaSchema() + + // migrate dev to get database tables ready + migrateDev(ctx) + + // no args + ctx.On("Argument", 0).Return("").Once() + assert.Nil(t, mdc.Handle(ctx)) +} diff --git a/database/console/prisma/studio_command.go b/database/console/prisma/studio_command.go deleted file mode 100644 index cdd55b3c9..000000000 --- a/database/console/prisma/studio_command.go +++ /dev/null @@ -1 +0,0 @@ -package prisma diff --git a/database/console/prisma/validate_command.go b/database/console/prisma/validate_command.go index cdd55b3c9..936923988 100644 --- a/database/console/prisma/validate_command.go +++ b/database/console/prisma/validate_command.go @@ -1 +1,42 @@ package prisma + +import ( + "strings" + + "github.com/goravel/framework/contracts/console" + "github.com/goravel/framework/contracts/console/command" + "github.com/steebchen/prisma-client-go/cli" +) + +type ValidateCommand struct{} + +func NewValidateCommand() *ValidateCommand { + return &ValidateCommand{} +} + +// Signature The name and signature of the console command. +func (receiver *ValidateCommand) Signature() string { + return "prisma:validate" +} + +// Description The console command description. +func (receiver *ValidateCommand) Description() string { + return "Validate a Prisma schema." +} + +// Extend The console command extend. +func (receiver *ValidateCommand) Extend() command.Extend { + return command.Extend{ + Category: "prisma", + } +} + +// Handle Execute the console command. +func (receiver *ValidateCommand) Handle(ctx console.Context) error { + args := strings.Split(ctx.Argument(0), " ") + cliCmds := []string{ + "validate", + } + cliCmds = append(cliCmds, args...) + return cli.Run(cliCmds, true) +} diff --git a/database/console/prisma/validate_command_test.go b/database/console/prisma/validate_command_test.go new file mode 100644 index 000000000..861b4064f --- /dev/null +++ b/database/console/prisma/validate_command_test.go @@ -0,0 +1,24 @@ +package prisma + +import ( + "testing" + + consolemocks "github.com/goravel/framework/mocks/console" + "github.com/stretchr/testify/assert" +) + +func TestValidateCommand(t *testing.T) { + ctx := &consolemocks.Context{} + mdc := NewValidateCommand() + + // init prisma + handleInitPrisma(ctx, t) + defer removePrisma() + + // create prisma schema + fillPrismaSchema() + + // no args + ctx.On("Argument", 0).Return("").Once() + assert.Nil(t, mdc.Handle(ctx)) +} diff --git a/database/console/prisma/version_comand_test.go b/database/console/prisma/version_comand_test.go new file mode 100644 index 000000000..cf1dd74a0 --- /dev/null +++ b/database/console/prisma/version_comand_test.go @@ -0,0 +1,17 @@ +package prisma + +import ( + "testing" + + consolemocks "github.com/goravel/framework/mocks/console" + "github.com/stretchr/testify/assert" +) + +func TestVersionCommand(t *testing.T) { + ctx := &consolemocks.Context{} + mdc := NewVersionCommand() + + // no args + ctx.On("Argument", 0).Return("").Once() + assert.Nil(t, mdc.Handle(ctx)) +} diff --git a/database/console/prisma/version_command.go b/database/console/prisma/version_command.go index cdd55b3c9..efb24f4e3 100644 --- a/database/console/prisma/version_command.go +++ b/database/console/prisma/version_command.go @@ -1 +1,42 @@ package prisma + +import ( + "strings" + + "github.com/goravel/framework/contracts/console" + "github.com/goravel/framework/contracts/console/command" + "github.com/steebchen/prisma-client-go/cli" +) + +type VersionCommand struct{} + +func NewVersionCommand() *VersionCommand { + return &VersionCommand{} +} + +// Signature The name and signature of the console command. +func (receiver *VersionCommand) Signature() string { + return "prisma:version" +} + +// Description The console command description. +func (receiver *VersionCommand) Description() string { + return "Print current version of Prisma components" +} + +// Extend The console command extend. +func (receiver *VersionCommand) Extend() command.Extend { + return command.Extend{ + Category: "prisma", + } +} + +// Handle Execute the console command. +func (receiver *VersionCommand) Handle(ctx console.Context) error { + args := strings.Split(ctx.Argument(0), " ") + cliCmds := []string{ + "version", + } + cliCmds = append(cliCmds, args...) + return cli.Run(cliCmds, true) +} From 33add44f5e35b98d2b78b64c36aee2e39f051747 Mon Sep 17 00:00:00 2001 From: hosseinmirzapur Date: Wed, 3 Jan 2024 13:23:55 +0330 Subject: [PATCH 3/5] added prisma commands to service provider --- database/service_provider.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/database/service_provider.go b/database/service_provider.go index 315f57f41..ba39d3101 100644 --- a/database/service_provider.go +++ b/database/service_provider.go @@ -7,6 +7,7 @@ import ( consolecontract "github.com/goravel/framework/contracts/console" "github.com/goravel/framework/contracts/foundation" "github.com/goravel/framework/database/console" + "github.com/goravel/framework/database/console/prisma" ) const BindingOrm = "goravel.orm" @@ -40,6 +41,8 @@ func (database *ServiceProvider) registerCommands(app foundation.Application) { config := app.MakeConfig() seeder := app.MakeSeeder() artisan := app.MakeArtisan() + + // main ORM artisan commands app.MakeArtisan().Register([]consolecontract.Command{ console.NewMigrateMakeCommand(config), console.NewMigrateCommand(config), @@ -54,4 +57,22 @@ func (database *ServiceProvider) registerCommands(app foundation.Application) { console.NewSeederMakeCommand(), console.NewFactoryMakeCommand(), }) + + // prisma ORM artisan commands + app.MakeArtisan().Register([]consolecontract.Command{ + prisma.NewDBExecCommand(), + prisma.NewDBPullCommand(), + prisma.NewDBPushCommand(), + prisma.NewDBSeedCommand(), + prisma.NewDebugCommand(), + prisma.NewFormatCommand(), + prisma.NewGenerateCommand(), + prisma.NewInitCommand(), + prisma.NewMigrateDeployCommand(), + prisma.NewMigrateDevCommand(), + prisma.NewMigrateResetCommand(), + prisma.NewMigrateStatusCommand(), + prisma.NewValidateCommand(), + prisma.NewVersionCommand(), + }) } From 9d97c433c6b72baf7e3bd09b4a1863fa8149deab Mon Sep 17 00:00:00 2001 From: hosseinmirzapur Date: Wed, 3 Jan 2024 13:34:57 +0330 Subject: [PATCH 4/5] added support for arguments in prisma:debug --- database/console/prisma/debug_command.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/database/console/prisma/debug_command.go b/database/console/prisma/debug_command.go index 523f33ed3..6ac0bd86f 100644 --- a/database/console/prisma/debug_command.go +++ b/database/console/prisma/debug_command.go @@ -1,6 +1,8 @@ package prisma import ( + "strings" + "github.com/goravel/framework/contracts/console" "github.com/goravel/framework/contracts/console/command" "github.com/steebchen/prisma-client-go/cli" @@ -31,5 +33,8 @@ func (receiver *DebugCommand) Extend() command.Extend { // Handle Execute the console command func (r *DebugCommand) Handle(ctx console.Context) error { - return cli.Run([]string{"debug"}, true) + args := ctx.Argument(0) + cliCmds := []string{"debug"} + cliCmds = append(cliCmds, strings.Split(args, " ")...) + return cli.Run(cliCmds, true) } From c00a57fd6e1bfcf966fe9ae4195a3ce2f6737030 Mon Sep 17 00:00:00 2001 From: hosseinmirzapur Date: Wed, 3 Jan 2024 13:36:07 +0330 Subject: [PATCH 5/5] added support for arguments in prisma:format --- database/console/prisma/format_command.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/database/console/prisma/format_command.go b/database/console/prisma/format_command.go index 8bfe8ecef..f52513800 100644 --- a/database/console/prisma/format_command.go +++ b/database/console/prisma/format_command.go @@ -1,6 +1,8 @@ package prisma import ( + "strings" + "github.com/goravel/framework/contracts/console" "github.com/goravel/framework/contracts/console/command" "github.com/steebchen/prisma-client-go/cli" @@ -31,5 +33,8 @@ func (receiver *FormatCommand) Extend() command.Extend { // Handle Execute the console command func (r *FormatCommand) Handle(ctx console.Context) error { - return cli.Run([]string{"format"}, true) + args := ctx.Argument(0) + cliCmds := []string{"debug"} + cliCmds = append(cliCmds, strings.Split(args, " ")...) + return cli.Run(cliCmds, true) }