Giter Site home page Giter Site logo

Comments (2)

hsluoyz avatar hsluoyz commented on July 19, 2024

@onichandame great idea. Can you make a PR to add a new constructor to accept conn as arg?

from typeorm-adapter.

onichandame avatar onichandame commented on July 19, 2024

The way how TypeORM manages tables(entities) is quite different from the MongDB's approach. In MongoDB, the tables(collections) are implicitly created the first time they are used, whereas TypeORM needs to provision tables(entities) before setting up the connection.

Because we have to allow each module to maintain the tables they each need, in TypeORM it is better to let each module handle their own connection with the schema they each use.

An approach to what I originally want is to allow each module to add tables(entities) to the same connection so we end up with a single connection for all modules. To achieve this, there are 2 options:

  1. feed all entities to the connection constructor
  2. pass the same connection to every module. Each module then adds its entities into the same connection

The first option is quite hard to maintain. The second option is not possible yet. This issue of TypeORM is related but no progress has been seen.

So the best choice, for now, is to manage the common connection options at one place and let modules to handle their connections themselves.

from typeorm-adapter.

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.