velocious 1.0.533 → 1.0.535
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/drivers/mysql/index.js +24 -11
- package/build/database/migration/index.js +20 -0
- package/build/database/migrator.js +5 -0
- package/build/database/tenants/data-copier.js +40 -5
- 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/drivers/mysql/index.d.ts.map +1 -1
- package/build/src/database/drivers/mysql/index.js +19 -10
- 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/database/tenants/data-copier.d.ts +31 -3
- package/build/src/database/tenants/data-copier.d.ts.map +1 -1
- package/build/src/database/tenants/data-copier.js +39 -6
- 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/drivers/mysql/index.js +24 -11
- package/src/database/migration/index.js +20 -0
- package/src/database/migrator.js +5 -0
- package/src/database/tenants/data-copier.js +40 -5
- package/src/environment-handlers/base.js +14 -0
- package/src/environment-handlers/node.js +23 -0
package/README.md
CHANGED
|
@@ -1102,6 +1102,8 @@ export default class CreateEvents extends Migration {
|
|
|
1102
1102
|
}
|
|
1103
1103
|
```
|
|
1104
1104
|
|
|
1105
|
+
Migrations that must be rerunnable can guard changes with `tableExists(...)`, `columnExists(table, column)` and `indexExists(table, index)` — a missing table yields `false` rather than throwing. See [docs/database-migrations.md](docs/database-migrations.md#guarding-schema-changes-in-rerunnable-migrations).
|
|
1106
|
+
|
|
1105
1107
|
## Run migrations from the command line
|
|
1106
1108
|
|
|
1107
1109
|
```bash
|
|
@@ -100,6 +100,27 @@ export default class BackgroundJobsStore {
|
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
+
/**
|
|
104
|
+
* Ensures the background-jobs schema (tables + columns) exists on the configured
|
|
105
|
+
* database, without initializing the runtime model. Lets `db:migrate` create the
|
|
106
|
+
* framework's own schema deterministically alongside app migrations — and capture
|
|
107
|
+
* it in the dumped structure SQL — instead of it only appearing once a store boots.
|
|
108
|
+
* Idempotent: reuses the same `_ensureSchema` the runtime store uses, which skips
|
|
109
|
+
* work already applied (tracked in `velocious_internal_migrations`).
|
|
110
|
+
* @param {import("../database/drivers/base.js").default} [db] - Reuse an already
|
|
111
|
+
* checked-out connection (e.g. the one `db:migrate` holds) rather than opening a
|
|
112
|
+
* nested checkout that would deadlock a single-connection pool.
|
|
113
|
+
* @returns {Promise<void>} - Resolves when the schema is present.
|
|
114
|
+
*/
|
|
115
|
+
async ensureSchema(db) {
|
|
116
|
+
// When a connection is handed in (the db:migrate path), the caller already owns
|
|
117
|
+
// the active configuration + connection context; calling setCurrent() here would
|
|
118
|
+
// clobber it (e.g. the browser test runner juggles multiple configurations).
|
|
119
|
+
if (!db) this.configuration.setCurrent()
|
|
120
|
+
|
|
121
|
+
await this._ensureSchema(db)
|
|
122
|
+
}
|
|
123
|
+
|
|
103
124
|
/**
|
|
104
125
|
* Runs enqueue.
|
|
105
126
|
* @param {object} args - Options.
|
|
@@ -746,35 +767,59 @@ export default class BackgroundJobsStore {
|
|
|
746
767
|
throw VelociousError.safe("background job scheduledAtMs must be a non-negative safe integer")
|
|
747
768
|
}
|
|
748
769
|
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
await this._reconcileConcurrency(db)
|
|
765
|
-
return
|
|
766
|
-
}
|
|
770
|
+
/**
|
|
771
|
+
* Ensures the background-jobs schema exists, reusing a caller-held connection when
|
|
772
|
+
* one is given rather than checking out its own.
|
|
773
|
+
* @param {import("../database/drivers/base.js").default} [existingDb] - Reuse an
|
|
774
|
+
* already-checked-out connection (e.g. the one `db:migrate` holds) instead of
|
|
775
|
+
* checking out a nested one — the nested checkout would deadlock a database
|
|
776
|
+
* whose pool is capped at a single connection already held by the caller.
|
|
777
|
+
* @returns {Promise<void>} - Resolves when the schema is present.
|
|
778
|
+
*/
|
|
779
|
+
async _ensureSchema(existingDb) {
|
|
780
|
+
if (existingDb) {
|
|
781
|
+
await this._applySchema(existingDb)
|
|
782
|
+
|
|
783
|
+
return
|
|
784
|
+
}
|
|
767
785
|
|
|
768
|
-
|
|
786
|
+
await this._withDb((db) => this._applySchema(db))
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
/**
|
|
790
|
+
* Creates or upgrades the background-jobs tables, columns and concurrency rows on
|
|
791
|
+
* the given connection.
|
|
792
|
+
* @param {import("../database/drivers/base.js").default} db - Database connection.
|
|
793
|
+
* @returns {Promise<void>} - Resolves when the schema is present.
|
|
794
|
+
*/
|
|
795
|
+
async _applySchema(db) {
|
|
796
|
+
await this._ensureMigrationsTable(db)
|
|
797
|
+
|
|
798
|
+
const alreadyApplied = await this._hasMigration(db)
|
|
799
|
+
|
|
800
|
+
// Even when the migration row is present, the jobs table itself can have
|
|
801
|
+
// been dropped underneath us by a transaction rollback in another caller
|
|
802
|
+
// (DDL is transactional on SQLite/MSSQL). Verify the table physically
|
|
803
|
+
// exists and recreate it when missing rather than trusting the migration
|
|
804
|
+
// row alone, otherwise later callers fail with "no such table".
|
|
805
|
+
if (alreadyApplied && await db.tableExists(JOBS_TABLE)) {
|
|
769
806
|
await this._ensureJobsTableColumns(db)
|
|
770
807
|
await this._ensureConcurrencyTable(db)
|
|
771
808
|
await this._reconcileQueueConcurrency(db)
|
|
772
809
|
await this._reconcileConcurrency(db)
|
|
773
810
|
|
|
774
|
-
|
|
811
|
+
return
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
await this._applyMigrations(db)
|
|
815
|
+
await this._ensureJobsTableColumns(db)
|
|
816
|
+
await this._ensureConcurrencyTable(db)
|
|
817
|
+
await this._reconcileQueueConcurrency(db)
|
|
818
|
+
await this._reconcileConcurrency(db)
|
|
775
819
|
|
|
776
|
-
|
|
777
|
-
|
|
820
|
+
if (alreadyApplied) return
|
|
821
|
+
|
|
822
|
+
await this._recordMigration(db, MIGRATION_VERSION)
|
|
778
823
|
}
|
|
779
824
|
|
|
780
825
|
/**
|
|
@@ -320,19 +320,32 @@ export default class VelociousDatabaseDriversMysql extends Base{
|
|
|
320
320
|
* @returns {import("../base.js").RetryableDatabaseErrorResult} - Retry info.
|
|
321
321
|
*/
|
|
322
322
|
retryableDatabaseError(error) {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
message.
|
|
330
|
-
|
|
331
|
-
|
|
323
|
+
/** @type {Error | undefined} */
|
|
324
|
+
let currentError = error
|
|
325
|
+
let shouldReconnect = false
|
|
326
|
+
|
|
327
|
+
while (currentError) {
|
|
328
|
+
const errorCode = "code" in currentError && typeof currentError.code == "string" ? currentError.code : undefined
|
|
329
|
+
const message = currentError.message || ""
|
|
330
|
+
|
|
331
|
+
if (errorCode == "ER_CHECKREAD" || message.includes("Record has changed since last read")) {
|
|
332
|
+
return {retry: true, reconnect: false, waitMs: 50}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
shouldReconnect ||= (
|
|
336
|
+
errorCode == "ECONNREFUSED" ||
|
|
337
|
+
message.includes("ECONNREFUSED") ||
|
|
338
|
+
message.includes("connect ECONNREFUSED") ||
|
|
339
|
+
message.includes("PROTOCOL_CONNECTION_LOST") ||
|
|
340
|
+
message.includes("Connection lost")
|
|
341
|
+
)
|
|
342
|
+
|
|
343
|
+
currentError = currentError.cause instanceof Error ? currentError.cause : undefined
|
|
344
|
+
}
|
|
332
345
|
|
|
333
346
|
return {
|
|
334
|
-
retry:
|
|
335
|
-
reconnect:
|
|
347
|
+
retry: shouldReconnect,
|
|
348
|
+
reconnect: shouldReconnect,
|
|
336
349
|
waitMs: 50
|
|
337
350
|
}
|
|
338
351
|
}
|
|
@@ -468,6 +468,26 @@ export default class VelociousDatabaseMigration {
|
|
|
468
468
|
return Boolean(false)
|
|
469
469
|
}
|
|
470
470
|
|
|
471
|
+
/**
|
|
472
|
+
* Checks whether an index with the given name exists on a table.
|
|
473
|
+
* @param {string} tableName - Table name.
|
|
474
|
+
* @param {string} indexName - Index name to look for.
|
|
475
|
+
* @returns {Promise<boolean>} - Whether the index exists on the table.
|
|
476
|
+
*/
|
|
477
|
+
async indexExists(tableName, indexName) {
|
|
478
|
+
const table = await this.getDriver().getTableByName(tableName, {throwError: false})
|
|
479
|
+
|
|
480
|
+
if (table) {
|
|
481
|
+
for (const index of await table.getIndexes()) {
|
|
482
|
+
if (index.getName() == indexName) {
|
|
483
|
+
return true
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
return false
|
|
489
|
+
}
|
|
490
|
+
|
|
471
491
|
/**
|
|
472
492
|
* Sets up the database schema for a gap-less positional list. Adds the
|
|
473
493
|
* position column (INT NOT NULL) if absent and creates a UNIQUE index on
|
|
@@ -204,6 +204,11 @@ export default class VelociousDatabaseMigrator {
|
|
|
204
204
|
|
|
205
205
|
if (!environmentHandler || Object.keys(filteredDbs).length == 0) return
|
|
206
206
|
|
|
207
|
+
// Ensure velocious' own framework schema (background jobs) before the structure
|
|
208
|
+
// dump, and unconditionally — the dump is gated to enabled environments but the
|
|
209
|
+
// framework schema must exist after every migrate so `db:migrate` (and thus
|
|
210
|
+
// schema:load of the dumped SQL) produces a complete DB in every environment.
|
|
211
|
+
await environmentHandler.ensureFrameworkSchema({dbs: filteredDbs})
|
|
207
212
|
await environmentHandler.afterMigrations({dbs: filteredDbs})
|
|
208
213
|
}
|
|
209
214
|
|
|
@@ -130,6 +130,35 @@ export default class DataCopier {
|
|
|
130
130
|
* @returns {Promise<Map<string, Record<string, unknown>[]>>} - Loaded rows grouped by table name.
|
|
131
131
|
*/
|
|
132
132
|
async loadRows(db, keyValue) {
|
|
133
|
+
return (await this.traversePlan(db, keyValue)).rowsByTableName
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Loads only the ids for `keyValue` for every table in the plan from `db`, using the same
|
|
138
|
+
* parent/child traversal as {@link DataCopier#loadRows} but selecting just the id column.
|
|
139
|
+
* Callers that only need to compare row membership — for example verifying a tenant already
|
|
140
|
+
* holds every default row before a cleanup delete — should use this instead of loadRows so
|
|
141
|
+
* they never materialise full rows; for large tenants that is the difference between a few
|
|
142
|
+
* kilobytes of ids and gigabytes of row data.
|
|
143
|
+
* @param {import("../drivers/base.js").default} db - Source or target database to traverse.
|
|
144
|
+
* @param {string} keyValue - Tenant key selecting the root plan rows.
|
|
145
|
+
* @returns {Promise<Map<string, string[]>>} - Loaded ids grouped by table name.
|
|
146
|
+
*/
|
|
147
|
+
async loadRowIds(db, keyValue) {
|
|
148
|
+
return (await this.traversePlan(db, keyValue, [this.idColumn])).idsByTableName
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Traverses the table plan for `keyValue`, querying each table by its tenant key column or
|
|
153
|
+
* (for child tables) by the ids already selected for its parent, and returns both the ids
|
|
154
|
+
* and the loaded rows grouped by table name. `selectColumns` bounds the columns each query
|
|
155
|
+
* selects; pass `[idColumn]` for an id-only traversal, or omit it to load full rows.
|
|
156
|
+
* @param {import("../drivers/base.js").default} db - Source or target database to traverse.
|
|
157
|
+
* @param {string} keyValue - Tenant key selecting the root plan rows.
|
|
158
|
+
* @param {string[]} [selectColumns] - Columns to select; defaults to every column.
|
|
159
|
+
* @returns {Promise<{idsByTableName: Map<string, string[]>, rowsByTableName: Map<string, Record<string, unknown>[]>}>} - Ids and rows grouped by table name.
|
|
160
|
+
*/
|
|
161
|
+
async traversePlan(db, keyValue, selectColumns) {
|
|
133
162
|
/** @type {Map<string, string[]>} */
|
|
134
163
|
const idsByTableName = new Map()
|
|
135
164
|
/** @type {Map<string, Record<string, unknown>[]>} */
|
|
@@ -142,6 +171,7 @@ export default class DataCopier {
|
|
|
142
171
|
rows = await this.queryRowsByColumn({
|
|
143
172
|
columnName: tableConfig.keyColumn,
|
|
144
173
|
db,
|
|
174
|
+
selectColumns,
|
|
145
175
|
tableName: tableConfig.tableName,
|
|
146
176
|
values: [keyValue]
|
|
147
177
|
})
|
|
@@ -157,6 +187,7 @@ export default class DataCopier {
|
|
|
157
187
|
rows = await this.queryRowsByColumn({
|
|
158
188
|
columnName: tableConfig.parentColumn,
|
|
159
189
|
db,
|
|
190
|
+
selectColumns,
|
|
160
191
|
tableName: tableConfig.tableName,
|
|
161
192
|
values: idsByTableName.get(tableConfig.parentTableName) || []
|
|
162
193
|
})
|
|
@@ -170,15 +201,16 @@ export default class DataCopier {
|
|
|
170
201
|
rowsByTableName.set(tableConfig.tableName, rows)
|
|
171
202
|
}
|
|
172
203
|
|
|
173
|
-
return rowsByTableName
|
|
204
|
+
return {idsByTableName, rowsByTableName}
|
|
174
205
|
}
|
|
175
206
|
|
|
176
207
|
/**
|
|
177
|
-
* Selects
|
|
178
|
-
*
|
|
208
|
+
* Selects `tableName` rows in `db` whose `columnName` is in `values`, chunked. `selectColumns`
|
|
209
|
+
* bounds the projection and defaults to every column.
|
|
210
|
+
* @param {{columnName: string, db: import("../drivers/base.js").default, selectColumns?: string[], tableName: string, values: string[]}} args - Table, column, projection, database, and values for the chunked lookup.
|
|
179
211
|
* @returns {Promise<Record<string, unknown>[]>} - Rows matching the supplied column values.
|
|
180
212
|
*/
|
|
181
|
-
async queryRowsByColumn({columnName, db, tableName, values}) {
|
|
213
|
+
async queryRowsByColumn({columnName, db, selectColumns, tableName, values}) {
|
|
182
214
|
const normalizedValues = uniqueStrings(values)
|
|
183
215
|
|
|
184
216
|
if (normalizedValues.length <= 0) {
|
|
@@ -188,9 +220,12 @@ export default class DataCopier {
|
|
|
188
220
|
const rows = []
|
|
189
221
|
const quotedTable = db.quoteTable(tableName)
|
|
190
222
|
const quotedColumn = db.quoteColumn(columnName)
|
|
223
|
+
const selectList = selectColumns
|
|
224
|
+
? selectColumns.map((column) => `${quotedTable}.${db.quoteColumn(column)}`).join(", ")
|
|
225
|
+
: `${quotedTable}.*`
|
|
191
226
|
|
|
192
227
|
for (const valuesChunk of chunks(normalizedValues, this.queryChunkSize)) {
|
|
193
|
-
const sql = `SELECT ${
|
|
228
|
+
const sql = `SELECT ${selectList} FROM ${quotedTable} WHERE ${quotedColumn} IN (${this.quotedValuesSql(db, valuesChunk)})`
|
|
194
229
|
|
|
195
230
|
rows.push(...await this.executeQuietQuery(db, sql))
|
|
196
231
|
}
|
|
@@ -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.
|
|
@@ -24,6 +24,19 @@ export default class BackgroundJobsStore {
|
|
|
24
24
|
* @returns {Promise<void>} - Resolves when ready.
|
|
25
25
|
*/
|
|
26
26
|
ensureReady(): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Ensures the background-jobs schema (tables + columns) exists on the configured
|
|
29
|
+
* database, without initializing the runtime model. Lets `db:migrate` create the
|
|
30
|
+
* framework's own schema deterministically alongside app migrations — and capture
|
|
31
|
+
* it in the dumped structure SQL — instead of it only appearing once a store boots.
|
|
32
|
+
* Idempotent: reuses the same `_ensureSchema` the runtime store uses, which skips
|
|
33
|
+
* work already applied (tracked in `velocious_internal_migrations`).
|
|
34
|
+
* @param {import("../database/drivers/base.js").default} [db] - Reuse an already
|
|
35
|
+
* checked-out connection (e.g. the one `db:migrate` holds) rather than opening a
|
|
36
|
+
* nested checkout that would deadlock a single-connection pool.
|
|
37
|
+
* @returns {Promise<void>} - Resolves when the schema is present.
|
|
38
|
+
*/
|
|
39
|
+
ensureSchema(db?: import("../database/drivers/base.js").default): Promise<void>;
|
|
27
40
|
/**
|
|
28
41
|
* Runs enqueue.
|
|
29
42
|
* @param {object} args - Options.
|
|
@@ -269,7 +282,23 @@ export default class BackgroundJobsStore {
|
|
|
269
282
|
* @returns {number} - Dispatch timestamp.
|
|
270
283
|
*/
|
|
271
284
|
_normalizeScheduledAtMs(scheduledAtMs: number | undefined, defaultScheduledAtMs: number): number;
|
|
272
|
-
|
|
285
|
+
/**
|
|
286
|
+
* Ensures the background-jobs schema exists, reusing a caller-held connection when
|
|
287
|
+
* one is given rather than checking out its own.
|
|
288
|
+
* @param {import("../database/drivers/base.js").default} [existingDb] - Reuse an
|
|
289
|
+
* already-checked-out connection (e.g. the one `db:migrate` holds) instead of
|
|
290
|
+
* checking out a nested one — the nested checkout would deadlock a database
|
|
291
|
+
* whose pool is capped at a single connection already held by the caller.
|
|
292
|
+
* @returns {Promise<void>} - Resolves when the schema is present.
|
|
293
|
+
*/
|
|
294
|
+
_ensureSchema(existingDb?: import("../database/drivers/base.js").default): Promise<void>;
|
|
295
|
+
/**
|
|
296
|
+
* Creates or upgrades the background-jobs tables, columns and concurrency rows on
|
|
297
|
+
* the given connection.
|
|
298
|
+
* @param {import("../database/drivers/base.js").default} db - Database connection.
|
|
299
|
+
* @returns {Promise<void>} - Resolves when the schema is present.
|
|
300
|
+
*/
|
|
301
|
+
_applySchema(db: import("../database/drivers/base.js").default): Promise<void>;
|
|
273
302
|
/**
|
|
274
303
|
* Runs ensure migrations table.
|
|
275
304
|
* @param {import("../database/drivers/base.js").default} db - Database connection.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../src/background-jobs/store.js"],"names":[],"mappings":"AAyDA;IACE;;;;;OAKG;IACH,mDAHG;QAAoD,aAAa,EAAzD,OAAO,qBAAqB,EAAE,OAAO;QACvB,kBAAkB;KAC1C,EAOA;IALC,qDAAkC;IAClC,uCAA4C;IAC5C,eAA8B;IAC9B,oCAAyB;IACzB,qCAAwC;IAG1C;;;OAGG;IACH,yBAFa,MAAM,CAMlB;IAED;;;OAGG;IACH,eAFa,OAAO,CAAC,IAAI,CAAC,CAgBzB;IAED;;;;;;;OAOG;IACH,oCALG;QAAqB,OAAO,EAApB,MAAM;QACS,IAAI,EAAnB,KAAK,CAAC,OAAC,CAAC;QACyC,OAAO;KAChE,GAAU,OAAO,CAAC,MAAM,CAAC,CA6D3B;IAED;;;;;OAKG;IACH,wBAHG;QAAmH,aAAa;KAChI,GAAU,OAAO,CAAC,OAAO,YAAY,EAAE,gBAAgB,GAAG,IAAI,CAAC,CAYjE;IAED;;;;;;;OAOG;IACH,oBAFa,OAAO,CAAC,OAAO,YAAY,EAAE,gBAAgB,GAAG,IAAI,CAAC,CAQjE;IAED;;;;;;;OAOG;IACH,2DALG;QAA4D,EAAE,EAAtD,OAAO,6BAA6B,EAAE,OAAO;QAC5B,mBAAmB,EAApC,IAAI,GAAG,GAAG;QACiG,aAAa;KAChI,GAAU,OAAO,CAAC,OAAO,YAAY,EAAE,gBAAgB,GAAG,IAAI,CAAC,CAwCjE;IAED;;;;;;;;;;;;OAYG;IACH,2B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nC,GAAU,OAAO,CAAC,OAAO,YAAY,EAAE,gBAAgB,GAAG,IAAI,CAAC,CAcjE;IAED;;;;;OAKG;IACH,uCAHG;QAAsB,eAAe;KACrC,GAAU,OAAO,CAAC,OAAO,YAAY,EAAE,gBAAgB,EAAE,CAAC,CA+C5D;IAED;;;;;;;;;;;;OAYG;IACH,+DALG;QAA6B,cAAc;QACd,WAAW;QAClB,SAAS;KAC/B,GAAU,OAAO,CAAC,MAAM,CAAC,CAmB3B;IAED;;;;;;;;;OASG;IACH,2DANG;QAAqB,MAAM,EAAnB,MAAM;QACO,MAAM,EAAnB,MAAM;QACO,MAAM,EAAnB,MAAM;QACO,SAAS,EAAtB,MAAM;KACd,GAAU,OAAO,CAAC,MAAM,CAAC,CA8B3B;IAED;;;OAGG;IACH,YAFa,OAAO,CAAC,IAAI,CAAC,CASzB;IAED;;;;OAIG;IACH,cAHW,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAY5B;IAED;;;;OAIG;IACH,4BAHW,MAAM,GACJ,MAAM,CAUlB;IAED;;;;OAIG;IACH,iCAHW,MAAM,GAAG,IAAI,GAAG,SAAS,GACvB,MAAM,CAQlB;IAED;;;;;OAKG;IACH,uCAJW,MAAM,GAAG,SAAS,wBAClB,MAAM,GACJ,MAAM,CAOlB;IAED
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../src/background-jobs/store.js"],"names":[],"mappings":"AAyDA;IACE;;;;;OAKG;IACH,mDAHG;QAAoD,aAAa,EAAzD,OAAO,qBAAqB,EAAE,OAAO;QACvB,kBAAkB;KAC1C,EAOA;IALC,qDAAkC;IAClC,uCAA4C;IAC5C,eAA8B;IAC9B,oCAAyB;IACzB,qCAAwC;IAG1C;;;OAGG;IACH,yBAFa,MAAM,CAMlB;IAED;;;OAGG;IACH,eAFa,OAAO,CAAC,IAAI,CAAC,CAgBzB;IAED;;;;;;;;;;;OAWG;IACH,kBALW,OAAO,6BAA6B,EAAE,OAAO,GAG3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