markgardner / node-flywaydb

NodeJs wrapper for flywaydb cli
Apache License 2.0
60 stars 26 forks source link

Flyway is not following through command when version is updating #34

Open yoavain-sundaysky opened 2 years ago

yoavain-sundaysky commented 2 years ago

I'm running the command

flyway --configfile=db/conf/flyway.js migrate

Every time there's a new version, the migrate (or any other command) does not complete after the download finishes. When running the command again, the migrate is completed. As a workaround, we run flyway info before the migrate.

You can reproduce this by setting in the config file a version other than the one currently installed. E.g.:

{    
    "downloads": {
        "expirationTimeInMs": 0
    },
    "version": "8.2.0"
}

(Or by deleting the content of the jlib folder)

Environment:

1st run log:

DOWNLOADING https://repo1.maven.org/maven2/org/flywaydb/flyway-commandline/8.2.0/flyway-commandline-8.2.0-windows-x64.zip

2nd run log:

A new version of Flyway is available
Upgrade to Flyway 8.2.1: https://rd.gt/2X0gakb
Flyway Community Edition 8.2.0 by Redgate
Database: jdbc:postgresql://localhost:5432/postgres (PostgreSQL 10.17)
Successfully validated 208 migrations (execution time 00:00.177s)
Current version of schema "public": 1.200
Schema "public" is up to date. No migration necessary.
yoavain-sundaysky commented 2 years ago

Looking at the code, it seems that you use extract-zip in the old callback-style API, which is deprecated as of version 2.0.0 https://github.com/maxogden/extract-zip/releases/tag/v2.0.0

yoavain-sundaysky commented 2 years ago

Opened a PR https://github.com/markgardner/node-flywaydb/pull/35

markgardner commented 2 years ago

Is the callback pattern causing the problem?

yoavain commented 2 years ago

Right, they changed the callback api to a promise api. so the callback passed as the 3rd parameter is never called.

yoavain commented 2 years ago

Any update on this?