in progress: table for units of measurements, etc

This commit is contained in:
Mikayla Dobson
2023-02-16 17:25:10 -06:00
parent 46454a84c2
commit 8ae6cf4ab0
9 changed files with 116 additions and 108 deletions

View File

@@ -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);

View File

@@ -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 {

View 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
);