Linden Crandall 5075f5c5d8
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
commit upstream files
2025-02-06 04:14:18 +09:00

32 lines
778 B
JavaScript

import appConfig from '../../src/config/app.js';
import logger from '../../src/helpers/logger.js';
import '../../src/config/orm.js';
import { client as knex } from '../../src/config/database.js';
export const renameMigrationsAsJsFiles = async () => {
if (!appConfig.isDev) {
return;
}
try {
const tableExists = await knex.schema.hasTable('knex_migrations');
if (tableExists) {
await knex('knex_migrations')
.where('name', 'like', '%.ts')
.update({
name: knex.raw("REPLACE(name, '.ts', '.js')"),
});
logger.info(
`Migration file names with typescript renamed as JS file names!`
);
}
} catch (err) {
logger.error(err.message);
}
await knex.destroy();
};
renameMigrationsAsJsFiles();