vesper icon indicating copy to clipboard operation
vesper copied to clipboard

Cannot use 'connectionName' and 'connectionOptionsReaderOptions' options together

Open henri-hulski opened this issue 6 years ago • 4 comments

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 avatar Jul 10 '18 08:07 henri-hulski

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 avatar Jul 10 '18 08:07 henri-hulski

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 avatar Jul 11 '18 18:07 henri-hulski

hmm try to checkout code and debug

pleerock avatar Jul 11 '18 19:07 pleerock

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

henri-hulski avatar Jul 12 '18 00:07 henri-hulski