fix: update sequelize check fail

This commit is contained in:
2025-04-10 00:46:38 +08:00
parent 2ae49eb4c8
commit 9e5340066f
5 changed files with 446 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
import { Sequelize } from 'sequelize';
import { config } from './config.ts';
import { log } from '../logger/index.ts';
export type PostgresConfig = {
postgres: {
username: string;
@@ -26,3 +27,13 @@ export const sequelize = new Sequelize({
...postgresConfig,
// logging: false,
});
sequelize
.authenticate({ logging: false })
.then(() => {
log.info('Database connected');
})
.catch((err) => {
log.error('Database connection failed', { err, config: postgresConfig });
process.exit(1);
});