Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "use strict";
- const file = require("glob");
- const knex = require("knex")({
- client: 'mysql',
- connection: {
- host : '127.0.0.1',
- user : 'root',
- password : 'password',
- database : 'habbo hotel',
- charset : 'utf8',
- }
- });
- global.Database = require("bookshelf")(knex);
- Database.plugin("registry");
- Database.model("User", { tableName : "users", groups : function() { return this.hasOne("Group", "id", "xhabbo_group"); }});
- Database.model("Group", { tableName : "permission_groups",});
- const User = Database.model("User");
- new User({ id : 158}).fetch({withRelated : ['groups']})
- .then(function (data) {
- console.log(data.toJSON());
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement