From 0f5242991185b4e97d61ffaeb7bcf4ced51ec1da Mon Sep 17 00:00:00 2001 From: JayWll Date: Mon, 13 Apr 2020 09:49:56 -0600 Subject: [PATCH] Adding table definition for settings. --- nodeapp/db/db.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/nodeapp/db/db.js b/nodeapp/db/db.js index f83acdd..42053d0 100644 --- a/nodeapp/db/db.js +++ b/nodeapp/db/db.js @@ -1,4 +1,4 @@ -const Sequelize = require('sequelize'); +const Sequelize = require('sequelize') const Op = Sequelize.Op // Setup database, using credentials set in .env @@ -6,7 +6,7 @@ const sequelize = new Sequelize('database', process.env.DB_USER, process.env.DB_ dialect: 'sqlite', logging: false, storage: '.data/database.sqlite' -}); +}) // Define 'readings' table structure const Readings = sequelize.define('readings', { @@ -16,6 +16,17 @@ const Readings = sequelize.define('readings', { reading: { type: Sequelize.INTEGER } -}); +}) -module.exports = {Op, Readings} +// Define 'settings' table structure +const Settings = sequelize.define('settings', { + key: { + type: Sequelize.STRING, + unique: true + }, + value: { + type: Sequelize.STRING + } +}) + +module.exports = {Op, Readings, Settings}