Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use 'connectionName' and 'connectionOptionsReaderOptions' options together #32

Open
henri-hulski opened this issue Jul 10, 2018 · 4 comments

Comments

@henri-hulski
Copy link

henri-hulski commented Jul 10, 2018

Hi just start to explore typeorm and vesper. Really great frameworks.
Before I tried Prisma and graphql-yoga, but this is so much cleaner and easier to reason about!
One question, is it possible to use a different typeorm connection than default in vesper bootstrap?
Which was defined in ormconfig.yml.

@henri-hulski
Copy link
Author

For example if I want to use the dev connection from the following configuration.

dev:
    type: "sqlite"
    database: "./todomvc.db"
    synchronize: true
    logging: false

test:
    type: "sqlite"
    database: "./test/test.db"
    synchronize: true
    logging: false
    dropSchema: true

@henri-hulski
Copy link
Author

henri-hulski commented Jul 11, 2018

Ok @pleerock pointed me to the solution:

  typeorm: {
    connectionName: 'development'
  }

I also need to point to the location of the config file as I'm in a monorepo and the standard file solution for typeorm config file doesn't work. I found out you can do that with:

  typeorm: {
    connectionOptionsReaderOptions: { root: path.join(__dirname, '..') }
  }

These both work fine in isolation, however when I want to use both:

  typeorm: {
    connectionOptionsReaderOptions: { root: path.join(__dirname, '..') },
    connectionName: 'development'
  }

I get the Connection \"default\" was not found. error.

@henri-hulski henri-hulski changed the title Using a different typeorm connection than default Cannot use connectionName and connectionOptionsReaderOptions options together Jul 11, 2018
@henri-hulski henri-hulski changed the title Cannot use connectionName and connectionOptionsReaderOptions options together Cannot use 'connectionName' and 'connectionOptionsReaderOptions' options together Jul 11, 2018
@pleerock
Copy link
Contributor

hmm try to checkout code and debug

@henri-hulski
Copy link
Author

@pleerock did you had a look in #34?
Maybe it's related.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants