Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var connectAndCreateSchema = function () {
//This assumes new tables each time you could just connect to the database
return comb.serial([
function () {
return DB.forceDropTable("blog", "user");
},
function () {
//drop and recreate the user
return DB.createTable("user", function () {
this.primaryKey("id");
this.name(String);
this.password(String);
this.dateOfBirth(Date);
this.isVerified(Boolean, {"default": false});
this.lastAccessed(Date);
this.created(sql.TimeStamp);
this.updated(sql.DateTime);
});
},
var createTables = function () {
return comb.serial([
function () {
return DB.forceDropTable("child", "stepFather", "biologicalFather");
},
function () {
return comb.when(
DB.createTable("biologicalFather", function () {
this.primaryKey("id");
this.name(String);
}),
DB.createTable("stepFather", function () {
this.primaryKey("id");
this.name(String, {unique: true});
})
);
},
var createTables = function () {
return comb.serial([
function () {
return DB.forceDropTable(["capital", "state"]);
},
function () {
return DB.createTable("state", function () {
this.primaryKey("id");
this.name(String)
this.population("integer");
this.founded(Date);
this.climate(String);
this.description("text");
});
},
function () {
return DB.createTable("capital", function () {
this.primaryKey("id");
var createTables = function () {
return comb.serial([
function () {
return DB.forceDropTable("child", "biologicalFather");
},
function () {
return DB.createTable("biologicalFather", function () {
this.primaryKey("id");
this.name(String);
});
},
function () {
return DB.createTable("child", function () {
this.primaryKey("id");
this.name(String);
this.foreignKey("biologicalFatherId", "biologicalFather", {key: "id"});
});
},
var createTables = function () {
return comb.serial([
function () {
return DB.forceDropTable(["staff", "executive", "manager", "employee"]);
},
function () {
return DB.createTable("employee", function () {
this.primaryKey("id");
this.name(String);
this.kind(String);
});
},
function () {
return DB.createTable("manager", function () {
this.foreignKey("id", "employee", {key: "id"});
this.numStaff("integer");
});
},
var createTables = function () {
return comb.serial([
function () {
return DB.forceDropTable("child", "stepFather", "biologicalFather");
},
function () {
return comb.when(
DB.createTable("biologicalFather", function () {
this.primaryKey("id");
this.name(String);
}),
DB.createTable("stepFather", function () {
this.primaryKey("id");
this.name(String, {unique: true});
})
);
},
var createTables = function () {
return comb.serial([
function () {
return DB.forceDropTable("classesStudents", "studentsClasses", "class", "student");
},
function () {
return comb.when(
DB.createTable("class", function () {
this.primaryKey("id");
this.semester("char", {size: 10});
this.name(String);
this.subject(String);
this.description("text");
this.graded(Boolean, {"default": true});
}),
DB.createTable("student", function () {
this.primaryKey("id");
this.firstName(String);
var connectAndCreateSchema = function () {
//This assumes new tables each time you could just connect to the database
return comb.serial([
function () {
return comb.when(
DB1.forceCreateTable("user", function () {
this.primaryKey("id");
this.firstName(String);
this.lastName(String);
this.password(String);
this.dateOfBirth(Date);
this.isVerified(Boolean, {"default": false})
this.created(sql.TimeStamp);
this.updated(sql.DateTime);
}),
//drop and recreate the user
DB2.forceCreateTable("user", function () {
this.primaryKey("id");
this.firstName(String);
var createTables = function () {
return comb.serial([
function () {
return DB.forceDropTable("classesStudents", "studentsClasses", "class", "student");
},
function () {
return comb.when(
DB.createTable("class", function () {
this.primaryKey("id");
this.semester("char", {size: 10});
this.name(String);
this.subject(String);
this.description("text");
this.graded(Boolean, {"default": true});
}),
DB.createTable("student", function () {
this.primaryKey("id");
this.firstName(String);
var loop = function (async, cb, limit) {
var saves = [];
limit = limit || LIMIT;
for (var i = 0; i < limit; i++) {
saves.push(async ? cb(i) : comb.partial(cb, i));
}
if (async) {
saves = new comb.PromiseList(saves, true);
}
return async ? saves : comb.serial(saves);
};