Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate arguments invalid #5

Open
bsherb53 opened this issue Dec 15, 2017 · 3 comments
Open

Migrate arguments invalid #5

bsherb53 opened this issue Dec 15, 2017 · 3 comments

Comments

@bsherb53
Copy link

It looks as though the migrateCommand arguments are not working.

If I send journey --url cassandra://127.0.0.1:9042/keyspace --path ./migrations migrate m -1 it looks as though relativeNInt, err := strconv.Atoi(relativeN) is trying to parse ctx.Args().First(), where the correct argument should be ctx.Args()[2].

So change the following code:

Action: func(ctx *cli.Context) error {
		relativeN := ctx.Args().First()
		relativeNInt, err := strconv.Atoi(relativeN)
		if err != nil {
			logErr(err).Fatal("Unable to parse param <n>")
		}
		log.Infof("Applying %d migrations", relativeNInt)
		pipe := pipep.New()
		go migrate.Migrate(pipe, ctx.GlobalString("url"), ctx.GlobalString("path"), relativeNInt)
		ok := readPipe(pipe)
		if !ok {
			os.Exit(1)
		}
		logCurrentVersion(ctx.GlobalString("url"), ctx.GlobalString("path"))
		return nil
	},

to:

Action: func(ctx *cli.Context) error {
	        relativeN := ctx.Args()[2]
		relativeNInt, err := strconv.Atoi(relativeN)
		if err != nil {
			logErr(err).Fatal("Unable to parse param <n>")
		}
		log.Infof("Applying %d migrations", relativeNInt)
		pipe := pipep.New()
		go migrate.Migrate(pipe, ctx.GlobalString("url"), ctx.GlobalString("path"), relativeNInt)
		ok := readPipe(pipe)
		if !ok {
			os.Exit(1)
		}
		logCurrentVersion(ctx.GlobalString("url"), ctx.GlobalString("path"))
		return nil
	},
@gravis
Copy link
Member

gravis commented Dec 15, 2017

Could you please make sure you have the latest version of github.com/db-journey/journey?
It looks like a duplicate of db-journey/journey#4
Please confirm

@bsherb53
Copy link
Author

@gravis I am on 2.1.1. I installed from scratch on 12/14/17 using instructions in the ReadMe

@gravis
Copy link
Member

gravis commented Dec 15, 2017

Ok, thanks for checking. I'll take a look this week-end!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants