Skip to content

migrateUp and migrateDown do not close their connections when finished #44

Description

@jrnail23

I'm using the migrate module directly (instead of the CLI) in jest test setups and teardowns (up on setup, down on teardown), and jest was hanging after the down migrations ran.
I noticed that migrateUp and migrateDown never close their connections after executing.
After adding the following finally blocks to each usage, jest stopped hanging, and its process was able to exit cleanly:

.finally(function () {
  return connection.close();
});

I'm pretty sure finally isn't supported everywhere yet, but the same can be accomplished via including the same in both a then and a catch. EDIT: actually, it's using the promises returned by rethink, which are bluebird promises (and thus, support finally).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions