mirror of
https://github.com/Kong/insomnia.git
synced 2026-10-26 00:29:35 -04:00
Add hookDatabaseInit() call to perform ops on DB startup
This commit is contained in:
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;
|
||||
|
||||
Reference in new issue
Block a user