mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-13 21:24:58 +08:00
13 lines
351 B
JavaScript
13 lines
351 B
JavaScript
|
|
module.exports = (db) => {
|
|
for (const modelName of Object.keys(db)) {
|
|
const model = db[modelName];
|
|
|
|
model.beforeCreate('increment-version-c', (instance) => {
|
|
instance.version = 1;
|
|
});
|
|
model.beforeUpdate('increment-version-u', (instance) => {
|
|
instance.version = instance.version ? instance.version + 1 : 1;
|
|
});
|
|
}
|
|
}
|