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}