STF -- 数据库定义

来源:互联网 发布:centos7修改ssh端口号 编辑:程序博客网 时间:2024/06/07 20:51

STF的数据库使用的是RethinkDB。RethinkDB启动后,在浏览器里输入http://stf_server_ip:8080即可打开RethinkDB后台管理中心。

在STF中,定义数据库的文件为stf_home/lib/db/tables.js。

var r = require('rethinkdb')module.exports = {  users: {//user表    primaryKey: 'email'  , indexes: {      adbKeys: {        indexFunction: function(user) {          return user('adbKeys')('fingerprint')        }      , options: {          multi: true        }      }    }  }, accessTokens: {//accessTokens表    primaryKey: 'id'  , indexes: {      email: null    }  }, vncauth: {//vncauth表    primaryKey: 'password'  , indexes: {      response: null    , responsePerDevice: {        indexFunction: function(row) {          return [row('response'), row('deviceId')]        }      }    }  }, devices: {//devices表    primaryKey: 'serial'  , indexes: {      owner: {        indexFunction: function(device) {          return r.branch(            device('present')          , device('owner')('email')          , r.literal()          )        }      }    , present: null    , providerChannel: {        indexFunction: function(device) {          return device('provider')('channel')        }      }    }  }, logs: {//logs表    primaryKey: 'id'  }}


0 0
原创粉丝点击