Added a config option for test data seeding

ref #110
This commit is contained in:
2021-01-20 17:25:46 +01:00
parent da9a359251
commit 67ba489fe2
2 changed files with 7 additions and 1 deletions

View File

@@ -1,6 +1,8 @@
import { createConnection } from "typeorm";
import { runSeeder } from 'typeorm-seeding';
import { config } from '../config';
import { User } from '../models/entities/User';
import SeedTestRunners from '../seeds/SeedTestRunners';
import SeedUsers from '../seeds/SeedUsers';
/**
* Loader for the database that creates the database connection and initializes the database tabels.
@@ -12,5 +14,8 @@ export default async () => {
if (await connection.getRepository(User).count() === 0) {
await runSeeder(SeedUsers);
}
if (config.seedTestData) {
await runSeeder(SeedTestRunners);
}
return connection;
};