Ben Carless 22225dfa8e added winston and verbose debugging | 1 year ago | |
---|---|---|
.gitignore | 1 year ago | |
index.js | 1 year ago | |
package-lock.json | 1 year ago | |
package.json | 1 year ago | |
readme.md | 1 year ago | |
test.js | 1 year ago |
This has been written quickly with little testing to fulfill and immediate need - contributions are appreciated.
const sqlGenerator = require('json-to-sequelize-model')
var data = JSON.parse(fs.readFileSync('object.json', 'utf-8'))
var data = {
}
// JSON to Sequelize Options
var options = {
modelOptions: {
primaryKey: "ID",
omitColumns: ["_RowNumber", "Person Responsible", "Progress", "Date", "Week Label"]
},
schemaOptions: {
arrays: {
mode: 'first'
}
}
}
sqlGenerator.jsonToModel(data, options).then((model) => {
console.log("Created model from JSON data.")
const Appointments = sqlBeyond.sequelize.define("123_Appt", model)
Appointments.sync()
})
I’ll tidy this up one day…