@keltoi/hydra 2.2.3 → 2.3.2

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 +6 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -359,6 +359,10 @@ class Migration{
359
359
  .where({ name })
360
360
  .update({ iteration })
361
361
 
362
+ #create = ({ iteration=0,name='' })=>this
363
+ .#db('migration')
364
+ .insert({ iteration,name })
365
+
362
366
  async runMigrations({ entity = Entity, migrations=[async ()=>{}] }){
363
367
  const name = entity.name;
364
368
 
@@ -372,7 +376,8 @@ class Migration{
372
376
  await migrations[index]();
373
377
  }
374
378
 
375
- await this.#update({ iteration:listSize,name });
379
+ if (listSize === 1) await this.#create({ iteration:listSize,name });
380
+ else await this.#update({ iteration:listSize,name });
376
381
  }
377
382
 
378
383
  static structMe(db=knex()){
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keltoi/hydra",
3
- "version": "2.2.3",
3
+ "version": "2.3.2",
4
4
  "description": "Boilerplate to start your API from zero using Repository Pattern",
5
5
  "main": "index.js",
6
6
  "module": "index.js",