-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from kuldeepmangla/main
added data
- Loading branch information
Showing
1 changed file
with
56 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,76 @@ | ||
//mysql connector pool | ||
const pool=require("./mysqlconnector"); | ||
const pool = require("./mysqlconnector"); | ||
|
||
function initialiseDB(){ | ||
pool.query("CREATE TABLE admin (id int,name varchar(50),email varchar(50));", (ex, rows) => { | ||
function initialiseDB() { | ||
pool.query( | ||
"CREATE TABLE admin (id int,name varchar(50),email varchar(50));", | ||
(ex, rows) => { | ||
if (ex) { | ||
console.log(ex); | ||
} else { | ||
console.log("created admin") | ||
console.log("created admin"); | ||
} | ||
}); | ||
|
||
pool.query("CREATE TABLE users (id int AUTO_INCREMENT,name varchar(50),email varchar(50),phone varchar(10),PRIMARY KEY (id));", (ex, rows) => { | ||
} | ||
); | ||
|
||
pool.query( | ||
"CREATE TABLE users (id int AUTO_INCREMENT,name varchar(50),email varchar(50),phone varchar(10),PRIMARY KEY (id));", | ||
(ex, rows) => { | ||
if (ex) { | ||
console.log(ex); | ||
} else { | ||
console.log("created users"); | ||
} | ||
} | ||
); | ||
pool.query( | ||
"CREATE TABLE menus (day varchar(25) primary key not null, breakfastMenu TEXT, lunchMenu TEXT, dinnerMenu TEXT);", | ||
(ex, rows) => { | ||
if (ex) { | ||
console.log(ex); | ||
} else { | ||
console.log("created users") | ||
console.log("created menu"); | ||
} | ||
}); | ||
pool.query("CREATE TABLE menus (day varchar(25) primary key not null, breakfastMenu TEXT, lunchMenu TEXT, dinnerMenu TEXT);", (ex, rows)=>{ | ||
if(ex){ | ||
console.log(ex); | ||
} else{ | ||
console.log("created menu"); | ||
} | ||
}); | ||
} | ||
); | ||
|
||
pool.query("CREATE TABLE shuttles (busno int,tripName varchar(50));", (ex, rows) => { | ||
pool.query( | ||
"CREATE TABLE shuttles (busno int,tripName varchar(50));", | ||
(ex, rows) => { | ||
if (ex) { | ||
console.log(ex); | ||
} else { | ||
console.log("created shuttles") | ||
console.log("created shuttles"); | ||
} | ||
}); | ||
|
||
pool.query("CREATE TABLE posts (id int AUTO_INCREMENT primary key, name varchar(128), content TEXT, date TIMESTAMP);", (ex, rows) => { | ||
} | ||
); | ||
|
||
pool.query( | ||
"CREATE TABLE posts (id int AUTO_INCREMENT primary key, name varchar(128), content TEXT, date TIMESTAMP);", | ||
(ex, rows) => { | ||
if (ex) { | ||
console.log(ex); | ||
} else { | ||
console.log("created posts") | ||
console.log("created posts"); | ||
} | ||
}); | ||
} | ||
|
||
} | ||
); | ||
pool.query( | ||
"INSERT into menus (day,breakfastMenu,lunchMenu,dinnerMenu) values ('Sunday','omlete','Chowmien','Dosa')", | ||
"INSERT into menus (day,breakfastMenu,lunchMenu,dinnerMenu) values ('Monday','breadjam','Rasam','Appalam')", | ||
"INSERT into menus (day,breakfastMenu,lunchMenu,dinnerMenu) values ('Tuesday','breadjam','Fulka','Rice')", | ||
"INSERT into menus (day,breakfastMenu,lunchMenu,dinnerMenu) values ('Wednesday','breadjam Milk','Rasam','Idli')", | ||
"INSERT into menus (day,breakfastMenu,lunchMenu,dinnerMenu) values ('Thrusday','omlete','Rasam','Peas Masala')", | ||
"INSERT into menus (day,breakfastMenu,lunchMenu,dinnerMenu) values ('Friday','breadjam','Chowmien','Appalam')", | ||
"INSERT into menus (day,breakfastMenu,lunchMenu,dinnerMenu) values ('Saturday','breadjam','Rasam','Appalam')", | ||
(ex, rows) => { | ||
if (ex) { | ||
console.log(ex); | ||
} else { | ||
console.log("Data added to menus"); | ||
} | ||
} | ||
); | ||
} | ||
|
||
initialiseDB(); |