Reputation: 49
I'm wondering if there is a way using Sequelize to add to the models I'm creating some additional info that doesn't need to be in the database. Specifically, some of my columns I need to designate as having a particular flag. I could just keep a list somewhere, I suppose, but I think it would make my code simpler if this flag were part of the model.
Upvotes: 1
Views: 902
Reputation: 241
If data that you want add is a Model property, you can use somethig like this: Model.__additionalInfo = {};
. But you must be careful because you can override the static Model methods.
If data that you want add is a instance propery, then you can use VIRTUAL data type for define attribute that would be preasent in each Model instance, but not stored in the DB.
Upvotes: 1