force

package
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cobra.Command{
	Use:   "force",
	Short: "后退一步数据库",
	Long:  `后退数据库`,
	RunE: func(cmd *cobra.Command, args []string) error {
		var cmdParse clap.YamlConfig
		if clap.GenPath != "" {
			configFileParams, err := clap.LoadConfigFile(clap.GenPath)
			if err != nil {
				return err
			}
			cmdParse = *configFileParams
		} else {

			if sourceURL != "" {
				cmdParse.SourceURL = sourceURL
			}
			if databaseURL != "" {
				cmdParse.DatabaseURL = databaseURL
			}
			if version > 0 {
				cmdParse.Version = version
			}
		}
		m, err := migrate.New(cmdParse.SourceURL, cmdParse.DatabaseURL)
		if err != nil {
			return err
		}
		defer func() {
			if _, err := m.Close(); err != nil {
				log.Error(err)
			}
		}()
		if err = m.Force(cmdParse.Version); err != nil {
			if errors.Is(err, migrate.ErrNoChange) {
				return nil
			}
			return err
		}
		return nil
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL