@keltoi/hydra 2.3.6 → 2.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +11 -8
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -365,19 +365,22 @@ class Migration{
|
|
|
365
365
|
})
|
|
366
366
|
|
|
367
367
|
async runMigrations({ entity = Entity, migrations=[async ()=>{}] }){
|
|
368
|
-
|
|
368
|
+
try{
|
|
369
|
+
const name = entity.name;
|
|
369
370
|
|
|
370
|
-
|
|
371
|
+
const { iteration } = await this.#get({ name });
|
|
371
372
|
|
|
372
|
-
|
|
373
|
+
const listSize = migrations.length;
|
|
373
374
|
|
|
374
|
-
|
|
375
|
+
if (iteration >= listSize) return
|
|
375
376
|
|
|
376
|
-
|
|
377
|
-
await migrations[index]()
|
|
378
|
-
.catch(err=>console.log(err));
|
|
377
|
+
migrations.forEach(async migration=> await migration());
|
|
379
378
|
|
|
380
|
-
|
|
379
|
+
await this.#update({ iteration:listSize,name });
|
|
380
|
+
} catch(err){
|
|
381
|
+
|
|
382
|
+
console.error(err);
|
|
383
|
+
}
|
|
381
384
|
}
|
|
382
385
|
|
|
383
386
|
static structMe(db=knex()){
|