#Can't connect to SQLite database with ormconfig.ts Typeorm

11 messages · Page 1 of 1 (latest)

stiff goblet
#

Trying to use Datasource, since CreateConnection has been deprecated. I'm willing to create and connect to a local sqlite database. But it seems that my nestjs wont connect to it, even though I can create and run migrations correctly
Here you can check my ormconfig.ts:


export const AppDataSource = new DataSource({
    type: 'sqlite',
    database: "./src/database/database.sqlite",
    entities: ['./src/shared/models/*.ts'],
    migrations: ["./src/migrations/**.ts"],
    logging: false,
    synchronize: false,
    subscribers: [],
});``` 

What Am I missing?
fiery slate
#

What error(s) are you getting?

stiff goblet
#

This one

#

Idk if a need to tag you or nah, so @fiery slate

fiery slate
#

Doesn't it need to be a default export?

stiff goblet
#

export default new DataSource({
    type: 'sqlite',
    database: "./src/database/database.sqlite",
    entities: ['./src/shared/models/*.ts'],
    migrations: ["./src/migrations/**.ts"],
    logging: false,
    synchronize: false,
    subscribers: [],
});``` like this? And at main.ts only import it?
#

Same error

fiery slate
stiff goblet
#

Ok, no problem with that. but When Traying to pass those configs to TypeormModule.forRoot() I get another error