Adding table definition for settings.

This commit is contained in:
JayWll 2020-04-13 09:49:56 -06:00
parent 6f3a5c923e
commit 0f52429911

View File

@ -1,4 +1,4 @@
const Sequelize = require('sequelize'); const Sequelize = require('sequelize')
const Op = Sequelize.Op const Op = Sequelize.Op
// Setup database, using credentials set in .env // 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', dialect: 'sqlite',
logging: false, logging: false,
storage: '.data/database.sqlite' storage: '.data/database.sqlite'
}); })
// Define 'readings' table structure // Define 'readings' table structure
const Readings = sequelize.define('readings', { const Readings = sequelize.define('readings', {
@ -16,6 +16,17 @@ const Readings = sequelize.define('readings', {
reading: { reading: {
type: Sequelize.INTEGER 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}