@keltoi/hydra 2.3.5 → 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.
Files changed (2) hide show
  1. package/index.js +11 -8
  2. 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
- const name = entity.name;
368
+ try{
369
+ const name = entity.name;
369
370
 
370
- const { iteration } = await this.#get({ name });
371
+ const { iteration } = await this.#get({ name });
371
372
 
372
- const listSize = migrations.length;
373
+ const listSize = migrations.length;
373
374
 
374
- if (iteration >= listSize) return
375
+ if (iteration >= listSize) return
375
376
 
376
- for (let index = iteration; index < listSize; index++)
377
- await migrations[index]()
378
- .catch(err=>console.log(err));
377
+ migrations.forEach(async migration=> await migration());
379
378
 
380
- await this.#update({ iteration:listSize,name });
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()){
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keltoi/hydra",
3
- "version": "2.3.5",
3
+ "version": "2.3.7",
4
4
  "description": "Boilerplate to start your API from zero using Repository Pattern",
5
5
  "main": "index.js",
6
6
  "module": "index.js",