Some checks are pending
Automatisch Backend Tests / test (push) Waiting to run
Automatisch CI / linter (push) Waiting to run
Automatisch CI / start-backend-server (push) Waiting to run
Automatisch CI / start-backend-worker (push) Waiting to run
Automatisch CI / build-web (push) Waiting to run
Automatisch UI Tests / test (push) Waiting to run
27 lines
652 B
JavaScript
27 lines
652 B
JavaScript
import './check-env-file.js';
|
|
import { createDatabaseAndUser } from '../../bin/database/utils.js';
|
|
import { client as knex } from '../../src/config/database.js';
|
|
import logger from '../../src/helpers/logger.js';
|
|
import appConfig from '../../src/config/app.js';
|
|
|
|
const createAndMigrateDatabase = async () => {
|
|
if (!appConfig.CI) {
|
|
await createDatabaseAndUser();
|
|
}
|
|
|
|
const migrator = knex.migrate;
|
|
|
|
await migrator.latest();
|
|
|
|
logger.info(`Completed database migrations for the test database.`);
|
|
};
|
|
|
|
createAndMigrateDatabase()
|
|
.then(() => {
|
|
process.exit(0);
|
|
})
|
|
.catch((error) => {
|
|
logger.error(error);
|
|
process.exit(1);
|
|
});
|