balmasi / migrate-mongoose

A node based migration framework for mongoose supporting ES6 migrations
MIT License
262 stars 83 forks source link

up never get's past "Synchronizing database with file system migrations" #67

Closed chris-aeviator closed 4 years ago

chris-aeviator commented 4 years ago

When setting up migrate-mongoose with a working mongo:// db connection and running migrate up the command will be issued (I can see that it is picking up my migration file by introducing an error into my JS code) but will never get past the point of "Synchronizing database with file system migrations".

This might be related to https://github.com/balmasi/migrate-mongoose/issues/6 , but I can see the migrate skript connect to mongo in mongo's logs, I can also see a migration appearing in my DB in the migrations table, it's state stays 'DOWN'.

When running the command with a DEBUG=* prepended, the only thing logged after Synchronizing... is mquery findOne migrations {} { sort: { createdAt: -1 }, projection: {} } +0ms

chris-aeviator commented 4 years ago

re-reading the example again I can confirm that an additional mongoDB connection in the models/index.js is required. After adding the required mongoose.connect('mongodb://localhost:27017/myDatabaseName', { useNewUrlParser: true }), everything works like expected