Masterchoc

Untitled

Jan 27th, 2018
666
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sequelize = require 'sequelize'
  2.  
  3. class Database
  4.     constructor: (@app) ->
  5.         if process.env.NODE_ENV == 'production'
  6.             cfg = @app.config.database.production
  7.         else if process.env.NODE_ENV == 'test'
  8.             cfg = @app.config.database.test
  9.         else
  10.             cfg = @app.config.database.development
  11.  
  12.         if @app.logger
  13.             @app.logger.info 'Selected new database : %s.', cfg.database
  14.  
  15.         return instance: new Sequelize(
  16.             cfg.database,
  17.             cfg.username,
  18.             cfg.password,
  19.             logging: false
  20.             dialect: cfg.dialect
  21.             timezone: "+01:00"
  22.             dialectOptions:
  23.                 charset: 'utf8mb4'
  24.             define:
  25.                 timestamps: true
  26.                 charset: 'utf8',
  27.                 collate: 'utf8_general_ci',
  28.         ),
  29.         sequelize: Sequelize
  30.  
  31. module.exports = Database
RAW Paste Data