mirror of
https://github.com/Kong/insomnia.git
synced 2026-04-21 14:47:46 -04:00
Add hookDatabaseInit() call to perform ops on DB startup
This commit is contained in:
@@ -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