Git Product home page Git Product logo

Comments (4)

balmasi avatar balmasi commented on September 26, 2024

@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.

vologab avatar vologab commented on September 26, 2024

@balmasi But if I will create separate connection, how I can obtain connection settings from migrator config?

from migrate-mongoose.

balmasi avatar balmasi commented on September 26, 2024

@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.

balmasi avatar balmasi commented on September 26, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.