code: function (dbName, sql) {
    EventEmitter.apply(this, arguments); // apply parent constructor
  
    this._addSqlErrorListener(); // register error handler before any SQL is executed
  
    this._dbName = dbName;
    this._sql = sql ? sql : new SQL(); // TODO: remove new SQL() as sql should always be injected
    this._registerDisconnectListener();
  
    this._globals = new Globals(this._sql);
    this._roles = new Roles(this._sql, this);
    this._userRoles = new UserRoles(this._sql);
    this._users = new Users(this._sql, this._roles, this._userRoles, this);
    this._colRoles = new ColRoles(this._sql);
    this._policy = new Policy(this._sql, this._roles, this._colRoles, this._userRoles);
    this._cols = new Cols(this._sql, this._policy);
    // this._sessions = new Sessions(this._sql, this._users);
  
    this._initPartitions();
  
    this._archive = new Archive(this._partitions, this._globals);
    this._attrs = new Attrs(this._partitions, this._policy, this._users, this._roles, this);
    this._docs = new Docs(this._partitions, this._attrs, this._policy, this._cols);
    this._attrs._docs = this._docs;
    this._queueAttrRecs = new QueueAttrRecs(this._sql);
    this._queue = new Queue(this._sql);
    this._process = new Process(this._sql, this._docs, this._users, this._queueAttrRecs,
      this._partitions, this._cols, this._policy, this._roles,
      this._userRoles, this._attrs, this);
    this._changes = new Changes(this._sql, this._globals, this._users);
  
    this._models = [this._globals, this._cols, this._users, this._roles, this._userRoles,
      this._colRoles, this._queueAttrRecs
      // this._sessions
    ];
  }
docs: Sessions = require('./sessions');