house, power, energy data generators, savers

This commit is contained in:
Eric Hulburd
2016-02-07 15:32:02 -06:00
parent d1e230c6fd
commit 3cb2320300
47 changed files with 246 additions and 89685 deletions

View File

@@ -0,0 +1,36 @@
import DB from "./../config/database";
const NAME = 'EnergyDatum';
/**
* Define your own types here
*/
var EnergyDatum = DB.sequelize.define(NAME, {
id: {
type: DB.Sequelize.INTEGER,
primaryKey: true,
autoIncrement: true // Automatically gets converted to SERIAL for postgres
},
day: DB.Sequelize.DATEONLY,
production: DB.Sequelize.FLOAT,
consumption: DB.Sequelize.FLOAT
}, {
paranoid: true,
underscored: true,
tableName: "energy_data",
instanceMethods: {
},
classMethods: {
set: ()=>{
EnergyDatum.associate();
},
associate: ()=>{
EnergyDatum.belongsTo(DB.House);
}
}
});
EnergyDatum.name = NAME;
module.exports = EnergyDatum;