ToolJet/server/scripts/sample-db-config-reset.ts

20 lines
701 B
TypeScript
Raw Normal View History

2025-02-25 06:52:50 +00:00
import { AppModule } from '@modules/app/module';
import { SampleDataSourceService } from '@modules/data-sources/services/sample-ds.service';
import { NestFactory } from '@nestjs/core';
async function sampleDbConfigReset() {
const app = await NestFactory.create(await AppModule.register({ IS_GET_CONTEXT: true }), {
logger: ['error', 'warn'],
});
const dataSourceService = app.get(SampleDataSourceService);
await dataSourceService.updateSampleDs();
await app.close();
// TODO: process exit wasn't needed earlier
// need to debug why app.close() doesn't exit gracefully
process.exit(0);
}
// eslint-disable-next-line @typescript-eslint/no-floating-promises
sampleDbConfigReset();