velocious 1.0.64 → 1.0.65

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.
@@ -22,5 +22,4 @@ for (let i = 0; i < processArgs.length; i++) {
22
22
  const cli = new Cli({parsedProcessArgs, processArgs})
23
23
 
24
24
  await cli.execute()
25
-
26
25
  process.exit(0)
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "bin": {
3
- "velocious": "bin/velocious.mjs"
3
+ "velocious": "bin/velocious.js"
4
4
  },
5
5
  "name": "velocious",
6
- "version": "1.0.64",
6
+ "version": "1.0.65",
7
7
  "main": "index.js",
8
8
  "scripts": {
9
9
  "test": "VELOCIOUS_TEST_DIR=../ cd spec/dummy && npx velocious test",
@@ -390,24 +390,26 @@ class VelociousDatabaseRecord {
390
390
  const isNewRecord = this.isNewRecord()
391
391
  let result
392
392
 
393
- await this._runValidations()
393
+ await this.constructor._getConfiguration().ensureConnections(async () => {
394
+ await this._runValidations()
394
395
 
395
- await this.constructor.transaction(async () => {
396
- // If any belongs-to-relationships was saved, then updated-at should still be set on this record.
397
- const {savedCount} = await this._autoSaveBelongsToRelationships()
396
+ await this.constructor.transaction(async () => {
397
+ // If any belongs-to-relationships was saved, then updated-at should still be set on this record.
398
+ const {savedCount} = await this._autoSaveBelongsToRelationships()
398
399
 
399
- if (this.isPersisted()) {
400
- // If any has-many-relationships will be saved, then updated-at should still be set on this record.
401
- const autoSaveHasManyrelationships = this._autoSaveHasManyAndHasOneRelationshipsToSave()
400
+ if (this.isPersisted()) {
401
+ // If any has-many-relationships will be saved, then updated-at should still be set on this record.
402
+ const autoSaveHasManyrelationships = this._autoSaveHasManyAndHasOneRelationshipsToSave()
402
403
 
403
- if (this._hasChanges() || savedCount > 0 || autoSaveHasManyrelationships.length > 0) {
404
- result = await this._updateRecordWithChanges()
404
+ if (this._hasChanges() || savedCount > 0 || autoSaveHasManyrelationships.length > 0) {
405
+ result = await this._updateRecordWithChanges()
406
+ }
407
+ } else {
408
+ result = await this._createNewRecord()
405
409
  }
406
- } else {
407
- result = await this._createNewRecord()
408
- }
409
410
 
410
- await this._autoSaveHasManyAndHasOneRelationships({isNewRecord})
411
+ await this._autoSaveHasManyAndHasOneRelationships({isNewRecord})
412
+ })
411
413
  })
412
414
 
413
415
  return result