balmasi / migrate-mongoose

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

Microservice environment #54

Open gregorskii opened 4 years ago

gregorskii commented 4 years ago

Migration is a bit wonky when migrations exist on the DB from another microservice and don't exist in the current migration folder.

This is likely an architecture issue on my end as each microservice could have its own database.

The migration goes like this in this case:

Migrate from "APPS" service: Works fine

Migrate from "USERS" service:

root@8a2d067bf04b:/usr/src/app# npm run migrate up create-apps-collection

> app-service@1.0.0 migrate /usr/src/app
> migrate "up" "create-apps-collection"

Synchronizing database with file system migrations...
? The following migrations exist in the migrations folder but not in the database. Select the ones you want to import into the database 1574819499749-create-apps-collection.js
Adding migration /usr/src/app/database/migrations/1574819499749-create-apps-collection.js into database from file system. State is DOWN
UP:    1574819499749-create-apps-collection.js
All migrations finished successfully.

Once you do this it's fine. But it makes it a bit difficult to hit space to accept the migration.