-
Notifications
You must be signed in to change notification settings - Fork 1
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 #21 from ebenezerdon/setup-travis-database-161624846
#161624846 Setup Travis Database
- Loading branch information
Showing
14 changed files
with
803 additions
and
236 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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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,81 @@ | ||
import pool from './db'; | ||
|
||
const seedProducts = () => { | ||
const text1 = `INSERT INTO | ||
products(productname, description, price, quantity, min) | ||
VALUES($1, $2, $3, $4, $5) | ||
returning *`; | ||
const values1 = [ | ||
'Long Sleeve T shirt', | ||
'Really cool stuff', | ||
'52000', | ||
41, | ||
25, | ||
]; | ||
const text2 = `INSERT INTO | ||
products(productname, description, price, quantity, min) | ||
VALUES($1, $2, $3, $4, $5) | ||
returning *`; | ||
const values2 = [ | ||
'Black Long Sleeve T shirt', | ||
'Another Long sleeve', | ||
'34512', | ||
45, | ||
21, | ||
]; | ||
pool.query(text1, values1); | ||
pool.query(text2, values2); | ||
}; | ||
|
||
const seedSales = () => { | ||
const text1 = `INSERT INTO | ||
sales(productname, productId, price, attendant_id, quantity) | ||
VALUES($1, $2, $3, $4, $5) | ||
returning *`; | ||
const values1 = [ | ||
'Long Sleeve T shirt', | ||
2, | ||
'52000', | ||
41, | ||
25, | ||
]; | ||
const text2 = `INSERT INTO | ||
sales(productname, productId, price, attendant_id, quantity) | ||
VALUES($1, $2, $3, $4, $5)`; | ||
const values2 = [ | ||
'Black Long Sleeve T shirt', | ||
2, | ||
'52000', | ||
42, | ||
21, | ||
]; | ||
pool.query(text1, values1); | ||
pool.query(text2, values2); | ||
}; | ||
|
||
const seedUsers = () => { | ||
const text1 = `INSERT INTO | ||
users(fullname, emailaddress, password, type) | ||
VALUES($1, $2, $3, $4)`; | ||
const values1 = [ | ||
'Admin', | ||
'admin@gmail.com', | ||
'adminpassword', | ||
'admin', | ||
]; | ||
const text2 = `INSERT INTO | ||
users(fullname, emailaddress, password, type) | ||
VALUES($1, $2, $3, $4)`; | ||
const values2 = [ | ||
'attendant', | ||
'attendant@gmail.com', | ||
'attendantpassword', | ||
'attendant', | ||
]; | ||
|
||
pool.query(text1, values1); | ||
pool.query(text2, values2); | ||
}; | ||
|
||
export { seedProducts, seedSales, seedUsers }; | ||
require('make-runnable'); |
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
Oops, something went wrong.