graphile/migrate

Root afterReset action does not work for command actions

jcgsville opened this issue · 1 comments

Summary

root: true only applies to afterReset actions of type sql not type command

Steps to reproduce

.gmrc

    "afterReset": [
        {
            "_": "command",
            "root": true,
            "command": "echo \"DB URL: ${GM_DBURL}\""
        }
    ],

In terminal run the following

ROOT_DATABASE_URL="postgres://localhost:5432/postgres" DATABASE_URL="postgres://eg_migrator:greatpassword@localhost:5432/eg" yarn run graphile-migrate reset --erase

Expected results

I'd expect to see this printed to the console

yarn run v1.22.10
$ /Users/chandler/Documents/projects/project-expedius/graphile/node_modules/.bin/graphile-migrate reset --erase
graphile-migrate: dropped database 'eg'
graphile-migrate: recreated database 'eg'
DB URL: postgres://localhost:5432/eg

Actual results

The following was printed to the console

yarn run v1.22.10
$ /Users/chandler/Documents/projects/project-expedius/graphile/node_modules/.bin/graphile-migrate reset --erase
graphile-migrate: dropped database 'eg'
graphile-migrate: recreated database 'eg'
DB URL: postgres://eg_migrator:greatpassword@localhost:5432/eg

Additional context

Using graphile migrate 1.0.2

Possible Solution

Fix needed here: https://github.com/graphile/migrate/blob/main/src/actions.ts

I think we're good to call this resolved