-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
28 lines (21 loc) · 1.2 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
//Generate customer insert
// CID 1-50 and mimiDollar is a random number 1-500
for(var i = 0;i<50 ;i++ ){
var randomMimiDollar = Math.random() * (500-1) + 1 ;
randomMimiDollar = Math.floor(randomMimiDollar)
console.log("INSERT INTO `mydb`.`Customer` (`CID`, `mimingDollars`) VALUES (" + i + ", " + randomMimiDollar+ ");")
}
//Generate Private Customer's data
//First half of customers
for(var i = 0; i<25; i++){
// INSERT INTO `mydb`.`PrivateCust` (`cName`, `email`, `mailingAddress`, `CID`) VALUES (NULL, NULL, NULL, NULL);
console.log(faker.fake("INSERT INTO `mydb`.`PrivateCust` (`cName`, `email`, `mailingAddress`, `CID`) VALUES ({{name.findName}}, {{internet.email}}, {{address.streetAddress}}, " + i +");" ));
}
//Generate Coprate Customer's data
//Second half of customers
for(var i = 25; i<50; i++){
// INSERT INTO `mydb`.`corporation` (`corpName`, `orgName`, `address`, `contact`, `CID`) VALUES (NULL, NULL, NULL, NULL, NULL);
var beg = "INSERT INTO `mydb`.`corporation` (`corpName`, `orgName`, `address`, `contact`, `CID`) ";
var end = faker.fake( "VALUES({{company.companyName}}, {{company.bs}}, {{address.streetAddress}}, {{name.findName}},"+ i + " );" );
console.log(beg+end)
}