Comments (4)
@vologab I suggest not using this('model2') and require
ing directly into your migration. I used to think it was a good idea to make this('model') available to the migrator, but I don't think the migrator should know about any models, let alone registering them on a separate mongoose connection.
I can fix this, but I'm thinking of removing that feature.
Your code should be handling that because all a migration framework should do is run migrations.
What do you think? @vologab
from migrate-mongoose.
@balmasi But if I will create separate connection, how I can obtain connection settings from migrator config?
from migrate-mongoose.
@vologab mmm good question.
My question in response is, why is that necessary?
You're assuming everyone wants their models to exist on the same db as their migrations db.
I think the config should only be to tell the migrator what DB/collection to use to WRITE and READ migration states, not the db your app models are registered.
Wouldn't you have your connection settings from the environment your code runs in? for example, If running migrations in prod, your models should already be registered using the prod connection in your code (from your environment variables or a similar mechanism)
Please let me know if you think I'm missing something
from migrate-mongoose.
Closing this because I think I've allowed enough time for discussion.
TLDR; I think the migrator should open an independent connection to the database rather than making assumptions about the database configurations of the user
from migrate-mongoose.
Related Issues (20)
- New Server Discover and Monitoring engine for MongoClient HOT 2
- Cannot find module '@/enums/roles'
- Use NPX instead of referencing the node module
- Ability to specify migrations for a given NODE_ENV, or support seeding for local versus migrations for production
- Microservice environment
- Are ES6 imports supported in 4.0.0? HOT 2
- Deprecation warning HOT 1
- Support Migration files with *.ts extension HOT 4
- Is this repo still maintained? HOT 4
- How do we setup migrate.json HOT 1
- I am getting "Cannot use import statement outside a module" HOT 4
- can i use migrate-mongoose in midway framework?
- up never get's past "Synchronizing database with file system migrations" HOT 1
- Unexpected token { when using the package in typescript project
- Is there a way to grab the `connectionUri` or any other useful information in the `up` or `down` functions?
- Schema hasn't been registered HOT 1
- Security vulnerability on dangling dependency of yargs "^4.8.1"
- Compromised colors package HOT 1
- Engine warning and timeout HOT 6
- Generate initial migrations?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from migrate-mongoose.