velocious 1.0.533 → 1.0.534
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/README.md +2 -0
- package/build/background-jobs/store.js +67 -22
- package/build/database/migration/index.js +20 -0
- package/build/database/migrator.js +5 -0
- package/build/environment-handlers/base.js +14 -0
- package/build/environment-handlers/node.js +23 -0
- package/build/src/background-jobs/store.d.ts +30 -1
- package/build/src/background-jobs/store.d.ts.map +1 -1
- package/build/src/background-jobs/store.js +62 -22
- package/build/src/database/migration/index.d.ts +7 -0
- package/build/src/database/migration/index.d.ts.map +1 -1
- package/build/src/database/migration/index.js +18 -1
- package/build/src/database/migrator.d.ts.map +1 -1
- package/build/src/database/migrator.js +6 -1
- package/build/src/environment-handlers/base.d.ts +13 -0
- package/build/src/environment-handlers/base.d.ts.map +1 -1
- package/build/src/environment-handlers/base.js +14 -1
- package/build/src/environment-handlers/node.d.ts.map +1 -1
- package/build/src/environment-handlers/node.js +22 -1
- package/package.json +1 -1
- package/src/background-jobs/store.js +67 -22
- package/src/database/migration/index.js +20 -0
- package/src/database/migrator.js +5 -0
- package/src/environment-handlers/base.js +14 -0
- package/src/environment-handlers/node.js +23 -0
|
@@ -508,6 +508,20 @@ export default class VelociousEnvironmentHandlerBase {
|
|
|
508
508
|
return
|
|
509
509
|
}
|
|
510
510
|
|
|
511
|
+
/**
|
|
512
|
+
* Ensures velocious' own framework-owned schema (e.g. the background-jobs
|
|
513
|
+
* tables) exists after app migrations run, so `db:migrate` produces a complete
|
|
514
|
+
* schema deterministically instead of it only appearing once a runtime store
|
|
515
|
+
* boots. Runs before the structure dump. No-op by default; the node handler
|
|
516
|
+
* overrides it.
|
|
517
|
+
* @param {object} args - Options object.
|
|
518
|
+
* @param {Record<string, import("../database/drivers/base.js").default>} args.dbs - Dbs being migrated.
|
|
519
|
+
* @returns {Promise<void>} - Resolves when complete.
|
|
520
|
+
*/
|
|
521
|
+
async ensureFrameworkSchema(args) { // eslint-disable-line no-unused-vars
|
|
522
|
+
return
|
|
523
|
+
}
|
|
524
|
+
|
|
511
525
|
/**
|
|
512
526
|
* Runs require command.
|
|
513
527
|
* @abstract
|
|
@@ -1005,6 +1005,29 @@ export default class VelociousEnvironmentHandlerNode extends Base{
|
|
|
1005
1005
|
return basePath
|
|
1006
1006
|
}
|
|
1007
1007
|
|
|
1008
|
+
/**
|
|
1009
|
+
* Ensures velocious' background-jobs schema exists on its configured database
|
|
1010
|
+
* as part of `db:migrate`, so the framework's own tables (background_jobs +
|
|
1011
|
+
* background_job_concurrency, execution_mode etc.) are created deterministically
|
|
1012
|
+
* alongside app migrations and captured in the dumped structure SQL — rather than
|
|
1013
|
+
* only appearing once a runtime store boots. Reuses the store's idempotent
|
|
1014
|
+
* `_ensureSchema`, so it's safe to re-run against DBs that already have it.
|
|
1015
|
+
* @param {object} args - Options object.
|
|
1016
|
+
* @param {Record<string, import("../database/drivers/base.js").default>} args.dbs - Dbs being migrated.
|
|
1017
|
+
* @returns {Promise<void>} - Resolves when complete.
|
|
1018
|
+
*/
|
|
1019
|
+
async ensureFrameworkSchema({dbs}) {
|
|
1020
|
+
const {default: BackgroundJobsStore} = await import("../background-jobs/store.js")
|
|
1021
|
+
const store = new BackgroundJobsStore({configuration: this.getConfiguration()})
|
|
1022
|
+
const databaseIdentifier = store.getDatabaseIdentifier() ?? "default"
|
|
1023
|
+
|
|
1024
|
+
// Reuse the connection db:migrate already holds for this database; opening a
|
|
1025
|
+
// nested checkout would deadlock a database whose pool is capped at one
|
|
1026
|
+
// connection. When the background-jobs database isn't among the migrated set,
|
|
1027
|
+
// this passes undefined and the store checks out its own (that pool is free).
|
|
1028
|
+
await store.ensureSchema(dbs[databaseIdentifier])
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1008
1031
|
/**
|
|
1009
1032
|
* Runs after migrations.
|
|
1010
1033
|
* @param {object} args - Options object.
|