Skip to content

Commit

Permalink
chore: logging for postgres & mysql
Browse files Browse the repository at this point in the history
  • Loading branch information
fratzinger committed May 13, 2024
1 parent 917ede1 commit 47ed0fe
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions test/connection.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
import type { Options } from 'sequelize';
import { Sequelize } from 'sequelize';

export default (DB?: 'postgres' | 'mysql' | string) => {
console.log('DB:', DB);
const logging: Options['logging'] = false;

if (DB === 'postgres') {
return new Sequelize('sequelize', 'postgres', 'password', {
host: 'localhost',
dialect: 'postgres'
dialect: 'postgres',
logging
});
} else if (DB === 'mysql') {
return new Sequelize('sequelize', 'root', '', {
host: '127.0.0.1',
dialect: 'mysql'
dialect: 'mysql',
logging
});
} else {
return new Sequelize('sequelize', '', '', {
dialect: 'sqlite',
storage: './db.sqlite',
logging: false
logging
});
}
};

0 comments on commit 47ed0fe

Please sign in to comment.