mirror of
https://github.com/movie-web/backend.git
synced 2025-09-13 16:33:26 +00:00
add basic repo setup, with user creation
This commit is contained in:
17
src/modules/mikro/orm.ts
Normal file
17
src/modules/mikro/orm.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { MikroORM, PostgreSqlDriver } from '@mikro-orm/postgresql';
|
||||
import path from 'path';
|
||||
|
||||
export async function createORM(url: string, log: (msg: string) => void) {
|
||||
return await MikroORM.init<PostgreSqlDriver>({
|
||||
type: 'postgresql',
|
||||
clientUrl: url,
|
||||
entities: ['./models/**/*.js'],
|
||||
entitiesTs: ['./models/**/*.ts'],
|
||||
baseDir: path.join(__dirname, '../../db'),
|
||||
migrations: {
|
||||
pathTs: './migrations/**/*.ts',
|
||||
path: './migrations/**/*.ts',
|
||||
},
|
||||
logger: log,
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user