Add hookDatabaseInit() call to perform ops on DB startup

This commit is contained in:
Gregory Schier committed 2018-12-03 13:43:43 -05:00
1 parent de03bba8fc
commit 8eb494dfe8
2 files changed
+10

No files matched your search

@@ -127,6 +127,12 @@ export async function init(types: Array<string>, config: Object = {}, forceReset
}
}
});
for (const model of models.all()) {
if (typeof model.hookDatabaseInit === 'function') {
await model.hookDatabaseInit();
}
}
}
// ~~~~~~~~~~~~~~~~ //
@@ -79,6 +79,10 @@ export async function migrate(doc: Object) {
return doc;
}
export async function hookDatabaseInit() {
console.log('Init responses DB');
}
export function hookRemove(doc: Response) {
if (!doc.bodyPath) {
return;