in progress: table for units of measurements, etc
This commit is contained in:
@@ -101,10 +101,25 @@ export default async function populate() {
|
||||
;
|
||||
`
|
||||
|
||||
const populateMeasurements = `
|
||||
INSERT INTO recipin.dropdownVals
|
||||
(name, datatype, datecreated)
|
||||
VALUES
|
||||
('cup', 'MEASUREMENTS', $1),
|
||||
('tablespoon', 'MEASUREMENTS', $1),
|
||||
('teaspoon', 'MEASUREMENTS', $1),
|
||||
('gram', 'MEASUREMENTS', $1),
|
||||
('ounce', 'MEASUREMENTS', $1),
|
||||
('fluid ounce', 'MEASUREMENTS', $1),
|
||||
('pound', 'MEASUREMENTS', $1)
|
||||
;
|
||||
`
|
||||
|
||||
const allStatements: Array<string> = [
|
||||
populateUsers, populateCuisines, populateCourses,
|
||||
populateCollection, populateIngredients, populateRecipes,
|
||||
populateGroceryList, populateFriendships, populateComments
|
||||
populateGroceryList, populateFriendships, populateComments,
|
||||
populateMeasurements
|
||||
];
|
||||
|
||||
await pool.query(setup);
|
||||
|
||||
@@ -28,11 +28,12 @@ dotenv.config();
|
||||
const recipecollection = fs.readFileSync(appRoot + '/db/sql/create/createcmp_recipecollection.sql').toString();
|
||||
const usersubscriptions = fs.readFileSync(appRoot + '/db/sql/create/createcmp_usersubscriptions.sql').toString();
|
||||
const userfriendships = fs.readFileSync(appRoot + '/db/sql/create/createcmp_userfriendships.sql').toString();
|
||||
const dropdownValues = fs.readFileSync(appRoot + '/db/sql/create/createdropdown.sql').toString();
|
||||
|
||||
const allStatements = [
|
||||
setRole, appusers, ingredient, collection, cuisine, course,
|
||||
recipe, recipecomments, groceryList, recipeingredient,
|
||||
recipecollection, usersubscriptions, userfriendships
|
||||
recipecollection, usersubscriptions, userfriendships, dropdownValues
|
||||
]
|
||||
|
||||
try {
|
||||
|
||||
6
server/db/sql/create/createdropdown.sql
Normal file
6
server/db/sql/create/createdropdown.sql
Normal file
@@ -0,0 +1,6 @@
|
||||
CREATE TABLE IF NOT EXISTS recipin.dropdownVals (
|
||||
id INT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
|
||||
name VARCHAR NOT NULL,
|
||||
datatype VARCHAR CHECK(datatype in ('MEASUREMENTS', 'COURSE', 'INGREDIENT')),
|
||||
datecreated VARCHAR NOT NULL
|
||||
);
|
||||
Reference in New Issue
Block a user