Major changes to the database structure: Delete and recreate the whole database (would require too many migrations otherwise). Removed a market, updated some images, added to the AP page, and merged bios.

This commit is contained in:
Wynne Crisman
2016-06-26 11:16:00 -07:00
parent abee7df2eb
commit a57900c065
16 changed files with 163 additions and 247 deletions

View File

@@ -10,21 +10,25 @@ module.exports = function(sequelize, DataTypes) {
autoIncrement: true
},
date: {
type: DataTypes.DATE,
type: DataTypes.DATEONLY,
allowNull: false
},
measure: {
type: DataTypes.JSONB,
quantity: {
type: DataTypes.DECIMAL(13,2),
allowNull: false
},
price: {
//GAAP standard is to use DECIMAL(13,4) for precision when dealing with money. 13 digits before the decimal, and 4 after it.
type: DataTypes.DECIMAL(13,4),
allowNull: false
}
}, {
freezeTableName: true, // Model tableName will be the same as the model name
classMethods: {
associate: function(models) {
//Sale.hasOne(models.Category, {as: 'category'});
//Sale.hasOne(models.Subcategory, {as: 'subcategory'});
Sale.belongsTo(models.Item, {as: 'item', foreignKey: {name: 'itemId', field: 'itemId'}});
Sale.belongsTo(models.Venue, {as: 'venue', foreignKey: {name: 'venueId', field: 'venueId'}});
Sale.belongsTo(models.Venue, {as: 'venue', foreignKey: {name: 'venueId', field: 'venueId'}});
Sale.belongsTo(models.Measure, {as: 'measure', foreignKey: {name: 'measureId', field: 'measureId'}});
}
}
});