parent
effa79032b
commit
473033aa50
@ -1,10 +1,15 @@
|
|||||||
import { createConnection } from "typeorm";
|
import { createConnection } from "typeorm";
|
||||||
|
import { runSeeder } from 'typeorm-seeding';
|
||||||
|
import { User } from '../models/entities/User';
|
||||||
|
import SeedUsers from '../seeds/SeedUsers';
|
||||||
/**
|
/**
|
||||||
* Loader for the database that creates the database connection and initializes the database tabels.
|
* Loader for the database that creates the database connection and initializes the database tabels.
|
||||||
*/
|
*/
|
||||||
export default async () => {
|
export default async () => {
|
||||||
const connection = await createConnection();
|
const connection = await createConnection();
|
||||||
connection.synchronize();
|
await connection.synchronize();
|
||||||
|
if (await connection.getRepository(User).count() === 0) {
|
||||||
|
await runSeeder(SeedUsers);
|
||||||
|
}
|
||||||
return connection;
|
return connection;
|
||||||
};
|
};
|
Loading…
x
Reference in New Issue
Block a user