-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBaseSeedSource.ts
More file actions
26 lines (23 loc) · 786 Bytes
/
BaseSeedSource.ts
File metadata and controls
26 lines (23 loc) · 786 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { seed as SSBUCharacters_seed } from "@db/seeds/SSBUCharacters";
import { getLogger } from "@logtape/logtape";
import type { Knex } from "knex";
const log = getLogger(["grindcord", "db"]);
// Seek more customizable API where list of seeds can be provided to the seedsource
export class BaseSeedSource {
getSeeds() {
return Promise.resolve(["SSBUCharacters"]);
}
async getSeed(seed: string) {
log.info(`Seeding ${seed}`);
switch (seed) {
case "SSBUCharacters":
return {
async seed(knex: Knex) {
await SSBUCharacters_seed(knex);
},
};
default:
throw new Error(`Invalid seed: "${seed}"`);
}
}
}