sequelizeInstance.ts 465 B

123456789101112131415161718192021
  1. import { Sequelize } from 'sequelize';
  2. import { getDatabasePath } from '../preload/utils';
  3. // doc: https://sequelize.org/docs/v6/getting-started/
  4. const logging = () => {};
  5. // const logging =
  6. // process.env.NODE_ENV === "production" ? () => {} : (msg) => console.log(msg);
  7. const sequelize = new Sequelize({
  8. dialect: 'sqlite',
  9. storage: getDatabasePath(),
  10. logging,
  11. pool: {
  12. max: 20,
  13. min: 5,
  14. acquire: 100000,
  15. },
  16. });
  17. export default sequelize;