diff --git a/cmd/atlas/internal/cmdapi/migrate.go b/cmd/atlas/internal/cmdapi/migrate.go index 77dc0eb12aa..0c0d0f6cf8f 100644 --- a/cmd/atlas/internal/cmdapi/migrate.go +++ b/cmd/atlas/internal/cmdapi/migrate.go @@ -41,6 +41,22 @@ import ( "github.com/spf13/cobra" ) +func init() { + migrateCmd := migrateCmd() + migrateCmd.AddCommand( + migrateApplyCmd(), + migrateDiffCmd(), + migrateHashCmd(), + migrateImportCmd(), + migrateLintCmd(), + migrateNewCmd(), + migrateSetCmd(), + migrateStatusCmd(), + migrateValidateCmd(), + ) + Root.AddCommand(migrateCmd) +} + // migrateCmd represents the subcommand 'atlas migrate'. func migrateCmd() *cobra.Command { cmd := &cobra.Command{ @@ -507,11 +523,6 @@ type migrateDiffFlags struct { // migrateDiffCmd represents the 'atlas migrate diff' subcommand. func migrateDiffCmd() *cobra.Command { - cmd, _ := migrateDiffWithFlagsCmd() - return cmd -} - -func migrateDiffWithFlagsCmd() (*cobra.Command, *migrateDiffFlags) { var ( flags migrateDiffFlags cmd = &cobra.Command{ @@ -556,7 +567,7 @@ directory state to the desired schema. The desired state can be another connecte cmd.Flags().BoolVarP(&flags.edit, flagEdit, "", false, "edit the generated migration file(s)") cobra.CheckErr(cmd.MarkFlagRequired(flagTo)) cobra.CheckErr(cmd.MarkFlagRequired(flagDevURL)) - return cmd, &flags + return cmd } func migrateDiffRun(cmd *cobra.Command, args []string, flags migrateDiffFlags, env *Env) error { diff --git a/cmd/atlas/internal/cmdapi/migrate_oss.go b/cmd/atlas/internal/cmdapi/migrate_oss.go deleted file mode 100644 index 9c13cc2c0aa..00000000000 --- a/cmd/atlas/internal/cmdapi/migrate_oss.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2021-present The Atlas Authors. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - -//go:build !ent - -package cmdapi - -func init() { - migrateCmd := migrateCmd() - migrateCmd.AddCommand( - migrateApplyCmd(), - migrateDiffCmd(), - migrateHashCmd(), - migrateImportCmd(), - migrateLintCmd(), - migrateNewCmd(), - migrateSetCmd(), - migrateStatusCmd(), - migrateValidateCmd(), - ) - Root.AddCommand(migrateCmd) -}