Feature/182 setup actions (#186)
* Create scripts * Create github workflows * Create initial DB migration script * Make default bot prefix configurable * Add bot token fetcher
This commit is contained in:
parent
cd666d24fd
commit
7decd28dc9
42 changed files with 525 additions and 83 deletions
20
src/helpers/MigrationHelper.ts
Normal file
20
src/helpers/MigrationHelper.ts
Normal file
|
@ -0,0 +1,20 @@
|
|||
import { readFileSync } from "fs";
|
||||
import { QueryRunner } from "typeorm";
|
||||
|
||||
export default class MigrationHelper {
|
||||
public static Up(migrationName: string, version: string, queryFiles: string[], queryRunner: QueryRunner) {
|
||||
for (let path of queryFiles) {
|
||||
const query = readFileSync(`${process.cwd()}/database/${version}/${migrationName}/Up/${path}.sql`).toString();
|
||||
|
||||
queryRunner.query(query);
|
||||
}
|
||||
}
|
||||
|
||||
public static Down(migrationName: string, version: string, queryFiles: string[], queryRunner: QueryRunner) {
|
||||
for (let path of queryFiles) {
|
||||
const query = readFileSync(`${process.cwd()}/database/${version}/${migrationName}/Down/${path}.sql`).toString();
|
||||
|
||||
queryRunner.query(query);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue