inheritance - sequelizejs, update attributes in inherit model -


i have model like:

---------------------- id | parent_id | sum 1  | nil       | 100 2  | 1         | 30 3  | 1         | 70 --------------------- 

if instance 3 changed sum 60, instance 1 's sum change 90 too.

currently, use afterupdate hook change parent's sum, may cause lot of sql find parent's instance.

any other suggestion??


Comments

Popular posts from this blog

html - How to custom Bootstrap grid height? -

javascript - pass values from mssql to views in node -

image - python get coordinates (pixels) of corresponding points from clicks -