init
This commit is contained in:
parent
99401e713c
commit
011ae4b467
@ -1,6 +1,8 @@
|
|||||||
import { Migrator } from '@mikro-orm/migrations';
|
import { Migrator } from '@mikro-orm/migrations';
|
||||||
import { defineConfig, Utils } from '@mikro-orm/postgresql';
|
import { defineConfig, Utils } from '@mikro-orm/postgresql';
|
||||||
|
|
||||||
|
import { SeedManager } from '@mikro-orm/seeder';
|
||||||
|
|
||||||
import { moduleImports } from '@/module.list';
|
import { moduleImports } from '@/module.list';
|
||||||
import { getEntities } from '@/modules/database/helpers';
|
import { getEntities } from '@/modules/database/helpers';
|
||||||
|
|
||||||
@ -16,5 +18,9 @@ export const database = () =>
|
|||||||
tableName: 'migrations',
|
tableName: 'migrations',
|
||||||
path: Utils.detectTsNode() ? 'src/database/migrations' : 'dist/database/migrations',
|
path: Utils.detectTsNode() ? 'src/database/migrations' : 'dist/database/migrations',
|
||||||
},
|
},
|
||||||
|
seeder: {
|
||||||
|
path: Utils.detectTsNode() ? 'src/database/seeders' : 'dist/database/seeders',
|
||||||
|
defaultSeeder: 'DatabaseSeeder',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
export default database();
|
export default database();
|
||||||
|
10
apps/api/src/database/seeders/DatabaseSeeder.ts
Normal file
10
apps/api/src/database/seeders/DatabaseSeeder.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import type { EntityManager } from '@mikro-orm/core';
|
||||||
|
import { Seeder } from '@mikro-orm/seeder';
|
||||||
|
|
||||||
|
import { PostSeeder } from './PostSeeder';
|
||||||
|
|
||||||
|
export class DatabaseSeeder extends Seeder {
|
||||||
|
async run(em: EntityManager): Promise<void> {
|
||||||
|
return this.call(em, [PostSeeder]);
|
||||||
|
}
|
||||||
|
}
|
6
apps/api/src/database/seeders/PostSeeder.ts
Normal file
6
apps/api/src/database/seeders/PostSeeder.ts
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
import type { EntityManager } from '@mikro-orm/core';
|
||||||
|
import { Seeder } from '@mikro-orm/seeder';
|
||||||
|
|
||||||
|
export class PostSeeder extends Seeder {
|
||||||
|
async run(em: EntityManager): Promise<void> {}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user