Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
exports.loadModels = function() {
var ret = new comb.Promise();
return comb.executeInOrder(helper, patio, function(helper, patio) {
var DB = helper.createTables();
var Company = patio.addModel(DB.from("company"), {
static:{
init:function () {
this._super(arguments);
this.oneToMany("employees", {fetchType : this.fetchType.EAGER});
}
}
});
var Employee = patio.addModel(DB.from("employee"), {
static:{
init:function () {
this._super(arguments);
this.manyToOne("company", {fetchType : this.fetchType.EAGER});
}
}
exports.loadModels = function () {
var ret = new comb.Promise();
return comb.executeInOrder(helper, patio, function (helper, patio) {
var DB = helper.createTables();
var Employee = patio.addModel(DB.from("employee"), {
plugins:[patio.plugins.TimeStampPlugin]
});
Employee.timestamp({updateOnCreate : true});
patio.syncModels();
});
};
exports.loadModels = function () {
var ret = new comb.Promise();
return comb.executeInOrder(helper, patio, function (helper, patio) {
var DB = helper.createTables();
var Works = patio.addModel(DB.from("works"), {
static:{
init:function () {
this._super(arguments);
this.manyToOne("employee");
}
}
});
var Employee = patio.addModel(DB.from("employee"), {
static:{
init:function () {
this._super(arguments);
this.oneToOne("works", function (ds) {
return ds.filter(function () {
return this.salary.gte(100000.00);
exports.dropModels = function () {
return comb.executeInOrder(patio, DB, function (patio, db) {
db.forceDropTable("employee");
patio.disconnect();
patio.identifierInputMethod = null;
patio.identifierOutputMethod = null;
});
};
exports.dropModels = function () {
return comb.executeInOrder(patio, DB, function (patio, db) {
db.forceDropTable("employee");
patio.disconnect();
patio.identifierInputMethod = null;
patio.identifierOutputMethod = null;
});
};
exports.loadModels = function () {
var ret = new comb.Promise();
return comb.executeInOrder(helper, patio, function (helper, patio) {
var DB = helper.createTables();
var Works = patio.addModel(DB.from("works"), {
static:{
init:function () {
this._super(arguments);
this.manyToOne("employee", {fetchType:this.fetchType.EAGER});
}
}
});
var Employee = patio.addModel(DB.from("employee"), {
static:{
init:function () {
this._super(arguments);
this.oneToOne("works", {fetchType:this.fetchType.EAGER}, function (ds) {
return ds.filter(function () {
return this.salary.gte(100000.00);
exports.loadModels = function () {
var ret = new comb.Promise();
return comb.executeInOrder(helper, patio, function (helper, patio) {
var DB = helper.createTables();
var Company = patio.addModel(DB.from("company"), {
static:{
init:function () {
this._super(arguments);
this.oneToMany("employees");
}
}
});
var Employee = patio.addModel(DB.from("employee"), {
static:{
init:function () {
this._super(arguments);
this.manyToOne("company");
}
}
exports.loadModels = function () {
var ret = new comb.Promise();
return comb.executeInOrder(helper, patio, function (helper, patio) {
var DB = helper.createTables(true);
var Company = patio.addModel(DB.from("company"), {
static:{
identifierOutputMethod:"camelize",
identifierInputMethod:"underscore",
init:function () {
this._super(arguments);
this.manyToMany("employees");
}
}
});
var Employee = patio.addModel(DB.from("employee"), {
static:{
exports.loadModels = function () {
var ret = new comb.Promise();
return comb.executeInOrder(helper, patio, function (helper, patio) {
var DB = helper.createTables();
var Company = patio.addModel(DB.from("company"), {
static:{
init:function () {
this._super(arguments);
this.oneToMany("employees", {key:"companyId"});
}
}
});
var Employee = patio.addModel(DB.from("employee"), {
static:{
init:function () {
this._super(arguments);
this.manyToOne("company", {key:"companyId"});
}
}
exports.dropTableAndDisconnect = function () {
return comb.executeInOrder(patio, DB, function (patio, db) {
db.forceDropTable(["leg_instance", "flight_leg", "flight", "airplane", "can_land", "airplane_type", "airport"]);
patio.disconnect();
});
};