forked from adityabisht02/BetterPoll-Backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
91 additions
and
19 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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
## PR Title | ||
<!--- Describe the problems, issues, or needs driving this feature/fix and include links to related issues --> | ||
The purpose of this Pull Request is to fix #<issue-number> | ||
|
||
|
||
### Postman Screenshots | ||
<!--- Include an short video or screenshot if the change affects the UI. --> | ||
|
||
|
||
## Checklist | ||
- [ ] I have tested in local Environment. | ||
- [ ] I have made the fix as per issue converstaion |
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,37 +1,81 @@ | ||
//mysql connector pool | ||
const pool=require("./mysqlconnector"); | ||
const pool = require("./mysqlconnector"); | ||
|
||
<<<<<<< HEAD | ||
function initialiseDB(){ | ||
pool.query("CREATE TABLE admin (id int,username varchar(50),password varchar(50),email varchar(50));", (ex, rows) => { | ||
======= | ||
function initialiseDB() { | ||
pool.query( | ||
"CREATE TABLE admin (id int,name varchar(50),email varchar(50));", | ||
(ex, rows) => { | ||
>>>>>>> e80f65e7013512bd9bc61dd922b0d68c99caec74 | ||
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 DEFAULT CURRENT_TIMESTAMP);", | ||
(ex, rows) => { | ||
if (ex) { | ||
console.log(ex); | ||
} else { | ||
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(); |
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