title: Sequelize not defined
body: <p>I am using sequelize for my orm database. I'm using mysql. </p>
  
  <p>I got this error when run the project.</p>
  
  <pre><code>var accounts = sequelize.define('OkAkun' , {//attrbut 
                           ^
  
  ReferenceError: sequelize is not defined
      at module.exports (/path_to_project/Backend/app/models/OkAkun.js:7:26)
      at Sequelize.import (/path_to_project/Backend/node_modules/sequelize/lib/sequelize.js:691:30)
      at /path_to_project/Backend/app/models/index.js:30:32
      at Array.forEach (native)
      at Object.&lt;anonymous&gt; (/path_to_project/Backend/app/models/index.js:29:3)
      at Module._compile (module.js:570:32)
      at Object.Module._extensions..js (module.js:579:10)
      at Module.load (module.js:487:32)
      at tryModuleLoad (module.js:446:12)
      at Function.Module._load (module.js:438:3)
      at Module.require (module.js:497:17)
      at require (internal/module.js:20:19)
      at Object.&lt;anonymous&gt; (/path_to_project/Backend/app/routes/routers.js:4:13)
      at Module._compile (module.js:570:32)
      at Object.Module._extensions..js (module.js:579:10)
      at Module.load (module.js:487:32)
  </code></pre>
  
  <p>Take a look for my file </p>
  
  <blockquote>
    <p>index.js</p>
  </blockquote>
  
  <pre><code>"use strict";
  var fs = require('fs');
  var path = require ('path');
  var Sequelize = require ('sequelize');
  var basename = path.basename(module.filename);
  var env = process.env.NODE_ENV || "development";
  var dbConfig =require(__base + "config/initializers/config.js").database;
  var sequelize;
  
  sequelize = new  Sequelize(dbConfig[env].database , dbConfig[env].username , dbConfig[env].password,
              {
                  "dialect": "mysql",
                  "host"  :dbConfig[env].host,
                  "port"  :dbConfig[env].port,
                  "logging": false,
                  "define": {underscored: true}
              });
  
  var db = {};
  
  fs
  .readdirSync(__dirname)
  .filter(function(file){
      return (file.indexOf(".") !== 0) &amp;&amp; (file !== basename);
  })
   .forEach(function(file) {
      var model  = sequelize.import(path.join(__dirname,file));
      db[model.name] = model;
   });
  
  Object.keys(db).forEach(function (modelName){
      if("associate" in db[modelName]){
          db[modelName].associate(db);
      }
  });
  
  db.sequelize = sequelize;
  db.Sequelize = Sequelize;
  
  
  
  module.exports = db;
  </code></pre>
  
  <p>and this is my model. When i run the project. it show error that sequelize not defined.</p>
  
  <blockquote>
    <p>OkAkun.js</p>
  </blockquote>
  
  <pre><code>module.exports  = function () {
  
  var accounts = sequelize.define('OkAkun' , {//attrbut 
  
      id_akun : {
          autoIncrement: true,
          type : DataTypes.INTEGER,
          allowNull: false,
          primaryKey : true
      },
      username:{
          type : DataTypes.STRING,
          allowNull: false
      },
      phone_number:{
          type: DataTypes.STRING,
          allowNull:false
      },
      email : {
          type: DataTypes.STRING,
          allowNull: true
      },
      create_at : {
          type: DataTypes.DATE,
          allowNull: false    
      },
      update_at : {
          type : DataTypes.DATE,
          allowNull: false
      },
      password : {
          type: DataTypes.STRING,
          allowNull: false
      }
  });
  
  return accounts;
  
  };
  </code></pre>
  
  <p>Fyi, i'm new in using orm for the database like sequelize. And i don't understand what step i missing here.</p>
  
  <p>Any thoughts?</p>