Adding sync() commands to database scripts
This commit is contained in:
parent
8832c658bf
commit
6d3e74aac9
@ -19,6 +19,9 @@ request({
|
|||||||
|
|
||||||
console.log(response.body.length + ' items retrieved')
|
console.log(response.body.length + ' items retrieved')
|
||||||
|
|
||||||
|
// Sync the database table
|
||||||
|
await db.Settings.sync()
|
||||||
|
|
||||||
// Remove existing database items
|
// Remove existing database items
|
||||||
await db.Readings.destroy({truncate: true})
|
await db.Readings.destroy({truncate: true})
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ const db = require('../db/db')
|
|||||||
const path = require('path')
|
const path = require('path')
|
||||||
require('dotenv').config({path: path.join(__dirname, '../../.env')})
|
require('dotenv').config({path: path.join(__dirname, '../../.env')})
|
||||||
|
|
||||||
|
db.Settings.sync().then(() => {
|
||||||
// Remove all previous settings
|
// Remove all previous settings
|
||||||
db.Settings.destroy({truncate: true})
|
db.Settings.destroy({truncate: true})
|
||||||
|
|
||||||
@ -10,3 +11,4 @@ db.Settings.create({ key: 'low-trigger', value: 100 })
|
|||||||
db.Settings.create({ key: 'high-trigger', value: 900 })
|
db.Settings.create({ key: 'high-trigger', value: 900 })
|
||||||
db.Settings.create({ key: 'low', value: false })
|
db.Settings.create({ key: 'low', value: false })
|
||||||
db.Settings.create({ key: 'alert', value: false })
|
db.Settings.create({ key: 'alert', value: false })
|
||||||
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user