Warn on Missing Migrations (#6580)

* added warn when migrations have not all been run

* fixed imports

* added better error handling

* Update api/src/database/index.ts

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>

* migration is its own file

* added custom migrations path

* Handle non-existing custom migrations folder

Co-authored-by: jaycammarano <jaycammarano@gmail.com>
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
This commit is contained in:
Jay Cammarano
2021-08-02 15:52:10 -04:00
committed by GitHub
parent 1881139188
commit 0b17fdcf81
7 changed files with 230 additions and 100 deletions

View File

@@ -5,12 +5,7 @@ import fse from 'fs-extra';
import { Knex } from 'knex';
import path from 'path';
import env from '../../env';
type Migration = {
version: string;
name: string;
timestamp: Date;
};
import { Migration } from '../../types';
export default async function run(database: Knex, direction: 'up' | 'down' | 'latest'): Promise<void> {
let migrationFiles = await fse.readdir(__dirname);