@nest-batch/typeorm 0.2.0 → 0.2.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.
- package/README.ko.md +55 -0
- package/README.md +27 -234
- package/dist/src/entities/job-meta.entities.d.ts +2 -2
- package/dist/src/entities/job-meta.entities.d.ts.map +1 -1
- package/dist/src/entities/job-meta.entities.js +3 -4
- package/dist/src/entities/job-meta.entities.js.map +1 -1
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +13 -6
- package/dist/src/index.js.map +1 -1
- package/dist/src/repository/typeorm-job-repository.d.ts +2 -2
- package/dist/src/repository/typeorm-job-repository.d.ts.map +1 -1
- package/dist/src/repository/typeorm-job-repository.js.map +1 -1
- package/package.json +5 -4
- package/src/entities/job-meta.entities.ts +5 -6
- package/src/index.ts +10 -6
- package/src/repository/typeorm-job-repository.ts +109 -75
- package/dist/src/migrations/1700000000000-CreateBatchMeta.d.ts +0 -28
- package/dist/src/migrations/1700000000000-CreateBatchMeta.d.ts.map +0 -1
- package/dist/src/migrations/1700000000000-CreateBatchMeta.js +0 -83
- package/dist/src/migrations/1700000000000-CreateBatchMeta.js.map +0 -1
- package/src/migrations/1700000000000-CreateBatchMeta.ts +0 -100
|
@@ -100,7 +100,11 @@ function mapJobExecution(r: JobExecutionRow): JobExecution {
|
|
|
100
100
|
id: r.id,
|
|
101
101
|
jobInstanceId: r.job_instance_id,
|
|
102
102
|
status: r.status as JobStatus,
|
|
103
|
-
startTime: r.start_time
|
|
103
|
+
startTime: r.start_time
|
|
104
|
+
? r.start_time instanceof Date
|
|
105
|
+
? r.start_time
|
|
106
|
+
: new Date(r.start_time)
|
|
107
|
+
: null,
|
|
104
108
|
endTime: r.end_time ? (r.end_time instanceof Date ? r.end_time : new Date(r.end_time)) : null,
|
|
105
109
|
exitCode: r.exit_code,
|
|
106
110
|
exitMessage: r.exit_message,
|
|
@@ -133,8 +137,8 @@ function mapStepExecution(r: StepExecutionRow): StepExecution {
|
|
|
133
137
|
* provided by the `@nest-batch/postgresql` (or future
|
|
134
138
|
* `@nest-batch/mysql`) driver sibling via the `TypeOrmDriverProvider`
|
|
135
139
|
* token. The repository itself uses raw SQL via `EntityManager.query`
|
|
136
|
-
*
|
|
137
|
-
*
|
|
140
|
+
* against the table contract represented by this package's exported
|
|
141
|
+
* TypeORM entities. The consuming app owns the runnable migration.
|
|
138
142
|
*
|
|
139
143
|
* The contract guarantees:
|
|
140
144
|
* - `getOrCreateJobInstance` is race-safe via the (jobName, jobKey)
|
|
@@ -151,9 +155,7 @@ function mapStepExecution(r: StepExecutionRow): StepExecution {
|
|
|
151
155
|
*/
|
|
152
156
|
@Injectable()
|
|
153
157
|
export class TypeOrmJobRepository extends JobRepository {
|
|
154
|
-
constructor(
|
|
155
|
-
@Inject(TypeOrmDriverProvider) private readonly dataSource: DataSource,
|
|
156
|
-
) {
|
|
158
|
+
constructor(@Inject(TypeOrmDriverProvider) private readonly dataSource: DataSource) {
|
|
157
159
|
super();
|
|
158
160
|
}
|
|
159
161
|
|
|
@@ -162,35 +164,35 @@ export class TypeOrmJobRepository extends JobRepository {
|
|
|
162
164
|
}
|
|
163
165
|
|
|
164
166
|
async getOrCreateJobInstance(name: string, jobKey: string): Promise<JobInstance> {
|
|
165
|
-
const existing = await this.em().query(
|
|
167
|
+
const existing = (await this.em().query(
|
|
166
168
|
`SELECT "id", "job_name", "job_key", "created_at"
|
|
167
169
|
FROM "batch_job_instance"
|
|
168
170
|
WHERE "job_name" = $1 AND "job_key" = $2
|
|
169
171
|
LIMIT 1`,
|
|
170
172
|
[name, jobKey],
|
|
171
|
-
) as JobInstanceRow[];
|
|
173
|
+
)) as JobInstanceRow[];
|
|
172
174
|
if (existing.length > 0) return mapJobInstance(existing[0]!);
|
|
173
175
|
|
|
174
176
|
const id = randomUUID();
|
|
175
177
|
try {
|
|
176
|
-
const inserted = await this.em().query(
|
|
178
|
+
const inserted = (await this.em().query(
|
|
177
179
|
`INSERT INTO "batch_job_instance" ("id", "job_name", "job_key", "created_at")
|
|
178
180
|
VALUES ($1, $2, $3, NOW())
|
|
179
181
|
ON CONFLICT ("job_name", "job_key") DO NOTHING
|
|
180
182
|
RETURNING "id", "job_name", "job_key", "created_at"`,
|
|
181
183
|
[id, name, jobKey],
|
|
182
|
-
) as JobInstanceRow[];
|
|
184
|
+
)) as JobInstanceRow[];
|
|
183
185
|
if (inserted.length > 0) return mapJobInstance(inserted[0]!);
|
|
184
186
|
} catch {
|
|
185
187
|
// Fall through to read-back.
|
|
186
188
|
}
|
|
187
|
-
const winner = await this.em().query(
|
|
189
|
+
const winner = (await this.em().query(
|
|
188
190
|
`SELECT "id", "job_name", "job_key", "created_at"
|
|
189
191
|
FROM "batch_job_instance"
|
|
190
192
|
WHERE "job_name" = $1 AND "job_key" = $2
|
|
191
193
|
LIMIT 1`,
|
|
192
194
|
[name, jobKey],
|
|
193
|
-
) as JobInstanceRow[];
|
|
195
|
+
)) as JobInstanceRow[];
|
|
194
196
|
if (winner.length === 0) {
|
|
195
197
|
throw new Error(
|
|
196
198
|
`Failed to upsert JobInstance (${name}, ${jobKey}) and could not read it back`,
|
|
@@ -199,10 +201,7 @@ export class TypeOrmJobRepository extends JobRepository {
|
|
|
199
201
|
return mapJobInstance(winner[0]!);
|
|
200
202
|
}
|
|
201
203
|
|
|
202
|
-
async createJobExecution(
|
|
203
|
-
jobInstanceId: string,
|
|
204
|
-
params: JobParameters,
|
|
205
|
-
): Promise<JobExecution> {
|
|
204
|
+
async createJobExecution(jobInstanceId: string, params: JobParameters): Promise<JobExecution> {
|
|
206
205
|
const exec = {
|
|
207
206
|
id: randomUUID(),
|
|
208
207
|
job_instance_id: jobInstanceId,
|
|
@@ -213,12 +212,12 @@ export class TypeOrmJobRepository extends JobRepository {
|
|
|
213
212
|
exit_message: '',
|
|
214
213
|
params: serializeContext(deepClone(params)),
|
|
215
214
|
};
|
|
216
|
-
const rows = await this.em().query(
|
|
215
|
+
const rows = (await this.em().query(
|
|
217
216
|
`INSERT INTO "batch_job_execution" ("id", "job_instance_id", "status", "start_time", "end_time", "exit_code", "exit_message", "params")
|
|
218
217
|
VALUES ($1, $2, $3, NULL, NULL, $4, $5, $6)
|
|
219
218
|
RETURNING "id", "job_instance_id", "status", "start_time", "end_time", "exit_code", "exit_message", "params"`,
|
|
220
219
|
[exec.id, exec.job_instance_id, exec.status, exec.exit_code, exec.exit_message, exec.params],
|
|
221
|
-
) as JobExecutionRow[];
|
|
220
|
+
)) as JobExecutionRow[];
|
|
222
221
|
return mapJobExecution(rows[0]!);
|
|
223
222
|
}
|
|
224
223
|
|
|
@@ -241,23 +240,23 @@ export class TypeOrmJobRepository extends JobRepository {
|
|
|
241
240
|
const isSqlite = this.dataSource.options.type === 'better-sqlite3';
|
|
242
241
|
let instanceId: string;
|
|
243
242
|
if (isSqlite) {
|
|
244
|
-
const rows = await em.query(
|
|
243
|
+
const rows = (await em.query(
|
|
245
244
|
`SELECT "id" FROM "batch_job_instance"
|
|
246
245
|
WHERE "job_name" = $1 AND "job_key" = $2
|
|
247
246
|
LIMIT 1`,
|
|
248
247
|
[name, jobKey],
|
|
249
|
-
) as Array<{ id: string }>;
|
|
248
|
+
)) as Array<{ id: string }>;
|
|
250
249
|
if (rows.length === 0) {
|
|
251
250
|
throw new JobExecutionAlreadyRunningError(name);
|
|
252
251
|
}
|
|
253
252
|
instanceId = rows[0]!.id;
|
|
254
253
|
} else {
|
|
255
|
-
const rows = await em.query(
|
|
254
|
+
const rows = (await em.query(
|
|
256
255
|
`SELECT "id" FROM "batch_job_instance"
|
|
257
256
|
WHERE "job_name" = $1 AND "job_key" = $2
|
|
258
257
|
FOR UPDATE SKIP LOCKED`,
|
|
259
258
|
[name, jobKey],
|
|
260
|
-
) as Array<{ id: string }>;
|
|
259
|
+
)) as Array<{ id: string }>;
|
|
261
260
|
if (rows.length === 0) {
|
|
262
261
|
throw new JobExecutionAlreadyRunningError(name);
|
|
263
262
|
}
|
|
@@ -265,24 +264,24 @@ export class TypeOrmJobRepository extends JobRepository {
|
|
|
265
264
|
}
|
|
266
265
|
|
|
267
266
|
// 3. Under the lock, verify no running execution.
|
|
268
|
-
const running = await em.query(
|
|
267
|
+
const running = (await em.query(
|
|
269
268
|
`SELECT "id" FROM "batch_job_execution"
|
|
270
269
|
WHERE "job_instance_id" = $1 AND "status" IN ($2, $3)
|
|
271
270
|
LIMIT 1`,
|
|
272
271
|
[instanceId, JobStatus.STARTING, JobStatus.STARTED],
|
|
273
|
-
) as Array<{ id: string }>;
|
|
272
|
+
)) as Array<{ id: string }>;
|
|
274
273
|
if (running.length > 0) {
|
|
275
274
|
throw new JobExecutionAlreadyRunningError(running[0]!.id);
|
|
276
275
|
}
|
|
277
276
|
|
|
278
277
|
// 4. Create the new execution row.
|
|
279
278
|
const execId = randomUUID();
|
|
280
|
-
const inserted = await em.query(
|
|
279
|
+
const inserted = (await em.query(
|
|
281
280
|
`INSERT INTO "batch_job_execution" ("id", "job_instance_id", "status", "start_time", "end_time", "exit_code", "exit_message", "params")
|
|
282
281
|
VALUES ($1, $2, $3, NULL, NULL, '', '', $4)
|
|
283
282
|
RETURNING "id", "job_instance_id", "status", "start_time", "end_time", "exit_code", "exit_message", "params"`,
|
|
284
283
|
[execId, instanceId, JobStatus.STARTING, serializeContext(deepClone(params))],
|
|
285
|
-
) as JobExecutionRow[];
|
|
284
|
+
)) as JobExecutionRow[];
|
|
286
285
|
return mapJobExecution(inserted[0]!);
|
|
287
286
|
});
|
|
288
287
|
}
|
|
@@ -291,11 +290,26 @@ export class TypeOrmJobRepository extends JobRepository {
|
|
|
291
290
|
const sets: string[] = [];
|
|
292
291
|
const values: unknown[] = [];
|
|
293
292
|
let i = 1;
|
|
294
|
-
if (patch.status !== undefined) {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
if (patch.
|
|
293
|
+
if (patch.status !== undefined) {
|
|
294
|
+
sets.push(`"status" = $${i++}`);
|
|
295
|
+
values.push(patch.status);
|
|
296
|
+
}
|
|
297
|
+
if (patch.startTime !== undefined) {
|
|
298
|
+
sets.push(`"start_time" = $${i++}`);
|
|
299
|
+
values.push(patch.startTime);
|
|
300
|
+
}
|
|
301
|
+
if (patch.endTime !== undefined) {
|
|
302
|
+
sets.push(`"end_time" = $${i++}`);
|
|
303
|
+
values.push(patch.endTime);
|
|
304
|
+
}
|
|
305
|
+
if (patch.exitCode !== undefined) {
|
|
306
|
+
sets.push(`"exit_code" = $${i++}`);
|
|
307
|
+
values.push(patch.exitCode);
|
|
308
|
+
}
|
|
309
|
+
if (patch.exitMessage !== undefined) {
|
|
310
|
+
sets.push(`"exit_message" = $${i++}`);
|
|
311
|
+
values.push(patch.exitMessage);
|
|
312
|
+
}
|
|
299
313
|
if (sets.length === 0) return;
|
|
300
314
|
values.push(executionId);
|
|
301
315
|
await this.em().query(
|
|
@@ -305,22 +319,22 @@ export class TypeOrmJobRepository extends JobRepository {
|
|
|
305
319
|
}
|
|
306
320
|
|
|
307
321
|
async getJobExecution(executionId: string): Promise<JobExecution | null> {
|
|
308
|
-
const rows = await this.em().query(
|
|
322
|
+
const rows = (await this.em().query(
|
|
309
323
|
`SELECT "id", "job_instance_id", "status", "start_time", "end_time", "exit_code", "exit_message", "params"
|
|
310
324
|
FROM "batch_job_execution" WHERE "id" = $1 LIMIT 1`,
|
|
311
325
|
[executionId],
|
|
312
|
-
) as JobExecutionRow[];
|
|
326
|
+
)) as JobExecutionRow[];
|
|
313
327
|
return rows.length > 0 ? mapJobExecution(rows[0]!) : null;
|
|
314
328
|
}
|
|
315
329
|
|
|
316
330
|
override async getJobInstance(jobInstanceId: string): Promise<JobInstance | null> {
|
|
317
|
-
const rows = await this.em().query(
|
|
331
|
+
const rows = (await this.em().query(
|
|
318
332
|
`SELECT "id", "job_name", "job_key", "created_at"
|
|
319
333
|
FROM "batch_job_instance"
|
|
320
334
|
WHERE "id" = $1
|
|
321
335
|
LIMIT 1`,
|
|
322
336
|
[jobInstanceId],
|
|
323
|
-
) as JobInstanceRow[];
|
|
337
|
+
)) as JobInstanceRow[];
|
|
324
338
|
return rows.length > 0 ? mapJobInstance(rows[0]!) : null;
|
|
325
339
|
}
|
|
326
340
|
|
|
@@ -336,13 +350,13 @@ export class TypeOrmJobRepository extends JobRepository {
|
|
|
336
350
|
where.push(`"job_key" = $${i++}`);
|
|
337
351
|
values.push(filter.jobKey);
|
|
338
352
|
}
|
|
339
|
-
const rows = await this.em().query(
|
|
353
|
+
const rows = (await this.em().query(
|
|
340
354
|
`SELECT "id", "job_name", "job_key", "created_at"
|
|
341
355
|
FROM "batch_job_instance"
|
|
342
356
|
${where.length > 0 ? `WHERE ${where.join(' AND ')}` : ''}
|
|
343
357
|
ORDER BY "created_at" ASC, "id" ASC`,
|
|
344
358
|
values,
|
|
345
|
-
) as JobInstanceRow[];
|
|
359
|
+
)) as JobInstanceRow[];
|
|
346
360
|
return rows.map(mapJobInstance);
|
|
347
361
|
}
|
|
348
362
|
|
|
@@ -368,57 +382,75 @@ export class TypeOrmJobRepository extends JobRepository {
|
|
|
368
382
|
where.push(`"start_time" <= $${i++}`);
|
|
369
383
|
values.push(filter.startedBefore);
|
|
370
384
|
}
|
|
371
|
-
const rows = await this.em().query(
|
|
385
|
+
const rows = (await this.em().query(
|
|
372
386
|
`SELECT "id", "job_instance_id", "status", "start_time", "end_time", "exit_code", "exit_message", "params"
|
|
373
387
|
FROM "batch_job_execution"
|
|
374
388
|
${where.length > 0 ? `WHERE ${where.join(' AND ')}` : ''}
|
|
375
389
|
ORDER BY "start_time" DESC NULLS LAST, "id" DESC`,
|
|
376
390
|
values,
|
|
377
|
-
) as JobExecutionRow[];
|
|
391
|
+
)) as JobExecutionRow[];
|
|
378
392
|
return rows.map(mapJobExecution);
|
|
379
393
|
}
|
|
380
394
|
|
|
381
395
|
async getRunningJobExecution(jobInstanceId: string): Promise<JobExecution | null> {
|
|
382
396
|
if (!jobInstanceId) return null;
|
|
383
|
-
const rows = await this.em().query(
|
|
397
|
+
const rows = (await this.em().query(
|
|
384
398
|
`SELECT "id", "job_instance_id", "status", "start_time", "end_time", "exit_code", "exit_message", "params"
|
|
385
399
|
FROM "batch_job_execution"
|
|
386
400
|
WHERE "job_instance_id" = $1 AND "status" IN ($2, $3)
|
|
387
401
|
ORDER BY "start_time" DESC NULLS LAST LIMIT 1`,
|
|
388
402
|
[jobInstanceId, JobStatus.STARTING, JobStatus.STARTED],
|
|
389
|
-
) as JobExecutionRow[];
|
|
403
|
+
)) as JobExecutionRow[];
|
|
390
404
|
return rows.length > 0 ? mapJobExecution(rows[0]!) : null;
|
|
391
405
|
}
|
|
392
406
|
|
|
393
|
-
async createStepExecution(
|
|
394
|
-
jobExecutionId: string,
|
|
395
|
-
stepName: string,
|
|
396
|
-
): Promise<StepExecution> {
|
|
407
|
+
async createStepExecution(jobExecutionId: string, stepName: string): Promise<StepExecution> {
|
|
397
408
|
const stepId = randomUUID();
|
|
398
|
-
const rows = await this.em().query(
|
|
409
|
+
const rows = (await this.em().query(
|
|
399
410
|
`INSERT INTO "batch_step_execution" ("id", "job_execution_id", "step_name", "status", "read_count", "write_count", "skip_count", "rollback_count", "commit_count", "exit_code", "exit_message", "created_at")
|
|
400
411
|
VALUES ($1, $2, $3, $4, 0, 0, 0, 0, 0, '', '', NOW())
|
|
401
412
|
RETURNING "id", "job_execution_id", "step_name", "status", "read_count", "write_count", "skip_count", "rollback_count", "commit_count", "exit_code", "exit_message", "created_at"`,
|
|
402
413
|
[stepId, jobExecutionId, stepName, StepStatus.STARTING],
|
|
403
|
-
) as StepExecutionRow[];
|
|
414
|
+
)) as StepExecutionRow[];
|
|
404
415
|
return mapStepExecution(rows[0]!);
|
|
405
416
|
}
|
|
406
417
|
|
|
407
|
-
async updateStepExecution(
|
|
408
|
-
stepExecutionId: string,
|
|
409
|
-
patch: StepExecutionPatch,
|
|
410
|
-
): Promise<void> {
|
|
418
|
+
async updateStepExecution(stepExecutionId: string, patch: StepExecutionPatch): Promise<void> {
|
|
411
419
|
const sets: string[] = [];
|
|
412
420
|
const values: unknown[] = [];
|
|
413
421
|
let i = 1;
|
|
414
|
-
if (patch.status !== undefined) {
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
if (patch.
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
+
if (patch.status !== undefined) {
|
|
423
|
+
sets.push(`"status" = $${i++}`);
|
|
424
|
+
values.push(patch.status);
|
|
425
|
+
}
|
|
426
|
+
if (patch.readCount !== undefined) {
|
|
427
|
+
sets.push(`"read_count" = $${i++}`);
|
|
428
|
+
values.push(patch.readCount);
|
|
429
|
+
}
|
|
430
|
+
if (patch.writeCount !== undefined) {
|
|
431
|
+
sets.push(`"write_count" = $${i++}`);
|
|
432
|
+
values.push(patch.writeCount);
|
|
433
|
+
}
|
|
434
|
+
if (patch.skipCount !== undefined) {
|
|
435
|
+
sets.push(`"skip_count" = $${i++}`);
|
|
436
|
+
values.push(patch.skipCount);
|
|
437
|
+
}
|
|
438
|
+
if (patch.rollbackCount !== undefined) {
|
|
439
|
+
sets.push(`"rollback_count" = $${i++}`);
|
|
440
|
+
values.push(patch.rollbackCount);
|
|
441
|
+
}
|
|
442
|
+
if (patch.commitCount !== undefined) {
|
|
443
|
+
sets.push(`"commit_count" = $${i++}`);
|
|
444
|
+
values.push(patch.commitCount);
|
|
445
|
+
}
|
|
446
|
+
if (patch.exitCode !== undefined) {
|
|
447
|
+
sets.push(`"exit_code" = $${i++}`);
|
|
448
|
+
values.push(patch.exitCode);
|
|
449
|
+
}
|
|
450
|
+
if (patch.exitMessage !== undefined) {
|
|
451
|
+
sets.push(`"exit_message" = $${i++}`);
|
|
452
|
+
values.push(patch.exitMessage);
|
|
453
|
+
}
|
|
422
454
|
if (sets.length === 0) return;
|
|
423
455
|
values.push(stepExecutionId);
|
|
424
456
|
await this.em().query(
|
|
@@ -428,22 +460,22 @@ export class TypeOrmJobRepository extends JobRepository {
|
|
|
428
460
|
}
|
|
429
461
|
|
|
430
462
|
async getStepExecution(stepExecutionId: string): Promise<StepExecution | null> {
|
|
431
|
-
const rows = await this.em().query(
|
|
463
|
+
const rows = (await this.em().query(
|
|
432
464
|
`SELECT "id", "job_execution_id", "step_name", "status", "read_count", "write_count", "skip_count", "rollback_count", "commit_count", "exit_code", "exit_message", "created_at"
|
|
433
465
|
FROM "batch_step_execution" WHERE "id" = $1 LIMIT 1`,
|
|
434
466
|
[stepExecutionId],
|
|
435
|
-
) as StepExecutionRow[];
|
|
467
|
+
)) as StepExecutionRow[];
|
|
436
468
|
return rows.length > 0 ? mapStepExecution(rows[0]!) : null;
|
|
437
469
|
}
|
|
438
470
|
|
|
439
471
|
override async findStepExecutions(jobExecutionId: string): Promise<StepExecution[]> {
|
|
440
|
-
const rows = await this.em().query(
|
|
472
|
+
const rows = (await this.em().query(
|
|
441
473
|
`SELECT "id", "job_execution_id", "step_name", "status", "read_count", "write_count", "skip_count", "rollback_count", "commit_count", "exit_code", "exit_message", "created_at"
|
|
442
474
|
FROM "batch_step_execution"
|
|
443
475
|
WHERE "job_execution_id" = $1
|
|
444
476
|
ORDER BY "created_at" ASC, "id" ASC`,
|
|
445
477
|
[jobExecutionId],
|
|
446
|
-
) as StepExecutionRow[];
|
|
478
|
+
)) as StepExecutionRow[];
|
|
447
479
|
return rows.map(mapStepExecution);
|
|
448
480
|
}
|
|
449
481
|
|
|
@@ -460,24 +492,24 @@ export class TypeOrmJobRepository extends JobRepository {
|
|
|
460
492
|
jobExecutionId: string,
|
|
461
493
|
stepName: string,
|
|
462
494
|
): Promise<StepExecution | null> {
|
|
463
|
-
const rows = await this.em().query(
|
|
495
|
+
const rows = (await this.em().query(
|
|
464
496
|
`SELECT "id", "job_execution_id", "step_name", "status", "read_count", "write_count", "skip_count", "rollback_count", "commit_count", "exit_code", "exit_message", "created_at"
|
|
465
497
|
FROM "batch_step_execution"
|
|
466
498
|
WHERE "job_execution_id" = $1 AND "step_name" = $2
|
|
467
499
|
ORDER BY "created_at" DESC, "id" DESC
|
|
468
500
|
LIMIT 1`,
|
|
469
501
|
[jobExecutionId, stepName],
|
|
470
|
-
) as StepExecutionRow[];
|
|
502
|
+
)) as StepExecutionRow[];
|
|
471
503
|
return rows.length > 0 ? mapStepExecution(rows[0]!) : null;
|
|
472
504
|
}
|
|
473
505
|
|
|
474
506
|
async getExecutionContext(scope: ExecutionScope): Promise<ExecutionContext> {
|
|
475
507
|
const key = scopeKey(scope);
|
|
476
508
|
if (key.startsWith('job::')) {
|
|
477
|
-
const rows = await this.em().query(
|
|
509
|
+
const rows = (await this.em().query(
|
|
478
510
|
`SELECT "data", "version" FROM "batch_job_execution_context" WHERE "job_execution_id" = $1 LIMIT 1`,
|
|
479
511
|
[key.slice(5)],
|
|
480
|
-
) as ContextRow[];
|
|
512
|
+
)) as ContextRow[];
|
|
481
513
|
if (rows.length > 0) {
|
|
482
514
|
return {
|
|
483
515
|
data: rows[0]!.data.length > 0 ? deserializeContext(rows[0]!.data) : null,
|
|
@@ -485,10 +517,10 @@ export class TypeOrmJobRepository extends JobRepository {
|
|
|
485
517
|
};
|
|
486
518
|
}
|
|
487
519
|
} else {
|
|
488
|
-
const rows = await this.em().query(
|
|
520
|
+
const rows = (await this.em().query(
|
|
489
521
|
`SELECT "data", "version" FROM "batch_step_execution_context" WHERE "step_execution_id" = $1 LIMIT 1`,
|
|
490
522
|
[key.slice(6)],
|
|
491
|
-
) as ContextRow[];
|
|
523
|
+
)) as ContextRow[];
|
|
492
524
|
if (rows.length > 0) {
|
|
493
525
|
return {
|
|
494
526
|
data: rows[0]!.data.length > 0 ? deserializeContext(rows[0]!.data) : null,
|
|
@@ -509,11 +541,12 @@ export class TypeOrmJobRepository extends JobRepository {
|
|
|
509
541
|
const serialized = serializeContext(deepClone(ctx.data));
|
|
510
542
|
if (key.startsWith('job::')) {
|
|
511
543
|
const jobExecutionId = key.slice(5);
|
|
512
|
-
const existing = await this.em().query(
|
|
544
|
+
const existing = (await this.em().query(
|
|
513
545
|
`SELECT "version" FROM "batch_job_execution_context" WHERE "job_execution_id" = $1 LIMIT 1`,
|
|
514
546
|
[jobExecutionId],
|
|
515
|
-
) as ContextRow[];
|
|
516
|
-
const nextVersion =
|
|
547
|
+
)) as ContextRow[];
|
|
548
|
+
const nextVersion =
|
|
549
|
+
version !== undefined ? version : existing.length > 0 ? existing[0]!.version + 1 : 0;
|
|
517
550
|
if (existing.length > 0) {
|
|
518
551
|
await this.em().query(
|
|
519
552
|
`UPDATE "batch_job_execution_context" SET "data" = $1, "version" = $2 WHERE "job_execution_id" = $3`,
|
|
@@ -527,11 +560,12 @@ export class TypeOrmJobRepository extends JobRepository {
|
|
|
527
560
|
}
|
|
528
561
|
} else {
|
|
529
562
|
const stepExecutionId = key.slice(6);
|
|
530
|
-
const existing = await this.em().query(
|
|
563
|
+
const existing = (await this.em().query(
|
|
531
564
|
`SELECT "version" FROM "batch_step_execution_context" WHERE "step_execution_id" = $1 LIMIT 1`,
|
|
532
565
|
[stepExecutionId],
|
|
533
|
-
) as ContextRow[];
|
|
534
|
-
const nextVersion =
|
|
566
|
+
)) as ContextRow[];
|
|
567
|
+
const nextVersion =
|
|
568
|
+
version !== undefined ? version : existing.length > 0 ? existing[0]!.version + 1 : 0;
|
|
535
569
|
if (existing.length > 0) {
|
|
536
570
|
await this.em().query(
|
|
537
571
|
`UPDATE "batch_step_execution_context" SET "data" = $1, "version" = $2 WHERE "step_execution_id" = $3`,
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { MigrationInterface, QueryRunner } from 'typeorm';
|
|
2
|
-
/**
|
|
3
|
-
* Creates the six batch meta-tables owned by
|
|
4
|
-
* this package:
|
|
5
|
-
*
|
|
6
|
-
* - batch_job_instance (root, unique on (job_name, job_key))
|
|
7
|
-
* - batch_job_execution (one per job run, indexed by instance)
|
|
8
|
-
* - batch_step_execution (one per step run, indexed by exec)
|
|
9
|
-
* - batch_job_execution_context (JSON payload + version, keyed by exec)
|
|
10
|
-
* - batch_step_execution_context (JSON payload + version, keyed by step)
|
|
11
|
-
*
|
|
12
|
-
* This migration intentionally uses generic ANSI/PostgreSQL
|
|
13
|
-
* syntax (varchar + text + timestamptz + int). The adapter
|
|
14
|
-
* package's `typeorm-job-repository` is portable across SQLite
|
|
15
|
-
* (test database) and PostgreSQL (production). Users targeting
|
|
16
|
-
* MySQL or another driver should adjust the `down` (and
|
|
17
|
-
* optionally `up`) to match their column types.
|
|
18
|
-
*
|
|
19
|
-
* The `params` column on `batch_job_execution` is a JSON
|
|
20
|
-
* snapshot — stored as `text` to keep the schema portable and
|
|
21
|
-
* always serialized, never queried structurally.
|
|
22
|
-
*/
|
|
23
|
-
export declare class CreateBatchMeta1700000000000 implements MigrationInterface {
|
|
24
|
-
name: string;
|
|
25
|
-
up(queryRunner: QueryRunner): Promise<void>;
|
|
26
|
-
down(queryRunner: QueryRunner): Promise<void>;
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=1700000000000-CreateBatchMeta.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"1700000000000-CreateBatchMeta.d.ts","sourceRoot":"","sources":["../../../src/migrations/1700000000000-CreateBatchMeta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,4BAA6B,YAAW,kBAAkB;IACrE,IAAI,SAAkC;IAEzB,EAAE,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAkE3C,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CAO3D"}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "CreateBatchMeta1700000000000", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return CreateBatchMeta1700000000000;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
let CreateBatchMeta1700000000000 = class CreateBatchMeta1700000000000 {
|
|
12
|
-
name = 'CreateBatchMeta1700000000000';
|
|
13
|
-
async up(queryRunner) {
|
|
14
|
-
await queryRunner.query(`
|
|
15
|
-
CREATE TABLE IF NOT EXISTS "batch_job_instance" (
|
|
16
|
-
"id" varchar(255) PRIMARY KEY,
|
|
17
|
-
"job_name" varchar(255) NOT NULL,
|
|
18
|
-
"job_key" varchar(255) NOT NULL,
|
|
19
|
-
"created_at" timestamptz NOT NULL DEFAULT now(),
|
|
20
|
-
CONSTRAINT "batch_job_instance_job_name_job_key_unique" UNIQUE ("job_name", "job_key")
|
|
21
|
-
)
|
|
22
|
-
`);
|
|
23
|
-
await queryRunner.query(`
|
|
24
|
-
CREATE TABLE IF NOT EXISTS "batch_job_execution" (
|
|
25
|
-
"id" varchar(255) PRIMARY KEY,
|
|
26
|
-
"job_instance_id" varchar(255) NOT NULL,
|
|
27
|
-
"status" varchar(20) NOT NULL,
|
|
28
|
-
"start_time" timestamptz NULL,
|
|
29
|
-
"end_time" timestamptz NULL,
|
|
30
|
-
"exit_code" varchar(255) NOT NULL DEFAULT '',
|
|
31
|
-
"exit_message" text NOT NULL DEFAULT '',
|
|
32
|
-
"params" text NOT NULL DEFAULT '{}'
|
|
33
|
-
)
|
|
34
|
-
`);
|
|
35
|
-
await queryRunner.query(`
|
|
36
|
-
CREATE INDEX IF NOT EXISTS "batch_job_execution_job_instance_id_index"
|
|
37
|
-
ON "batch_job_execution" ("job_instance_id")
|
|
38
|
-
`);
|
|
39
|
-
await queryRunner.query(`
|
|
40
|
-
CREATE TABLE IF NOT EXISTS "batch_step_execution" (
|
|
41
|
-
"id" varchar(255) PRIMARY KEY,
|
|
42
|
-
"job_execution_id" varchar(255) NOT NULL,
|
|
43
|
-
"step_name" varchar(255) NOT NULL,
|
|
44
|
-
"status" varchar(20) NOT NULL,
|
|
45
|
-
"read_count" int NOT NULL DEFAULT 0,
|
|
46
|
-
"write_count" int NOT NULL DEFAULT 0,
|
|
47
|
-
"skip_count" int NOT NULL DEFAULT 0,
|
|
48
|
-
"rollback_count" int NOT NULL DEFAULT 0,
|
|
49
|
-
"commit_count" int NOT NULL DEFAULT 0,
|
|
50
|
-
"exit_code" varchar(255) NOT NULL DEFAULT '',
|
|
51
|
-
"exit_message" text NOT NULL DEFAULT '',
|
|
52
|
-
"created_at" timestamptz NOT NULL DEFAULT now()
|
|
53
|
-
)
|
|
54
|
-
`);
|
|
55
|
-
await queryRunner.query(`
|
|
56
|
-
CREATE INDEX IF NOT EXISTS "batch_step_execution_job_execution_id_index"
|
|
57
|
-
ON "batch_step_execution" ("job_execution_id")
|
|
58
|
-
`);
|
|
59
|
-
await queryRunner.query(`
|
|
60
|
-
CREATE TABLE IF NOT EXISTS "batch_job_execution_context" (
|
|
61
|
-
"job_execution_id" varchar(255) PRIMARY KEY,
|
|
62
|
-
"data" text NOT NULL,
|
|
63
|
-
"version" int NOT NULL DEFAULT 0
|
|
64
|
-
)
|
|
65
|
-
`);
|
|
66
|
-
await queryRunner.query(`
|
|
67
|
-
CREATE TABLE IF NOT EXISTS "batch_step_execution_context" (
|
|
68
|
-
"step_execution_id" varchar(255) PRIMARY KEY,
|
|
69
|
-
"data" text NOT NULL,
|
|
70
|
-
"version" int NOT NULL DEFAULT 0
|
|
71
|
-
)
|
|
72
|
-
`);
|
|
73
|
-
}
|
|
74
|
-
async down(queryRunner) {
|
|
75
|
-
await queryRunner.query(`DROP TABLE IF EXISTS "batch_step_execution_context"`);
|
|
76
|
-
await queryRunner.query(`DROP TABLE IF EXISTS "batch_job_execution_context"`);
|
|
77
|
-
await queryRunner.query(`DROP TABLE IF EXISTS "batch_step_execution"`);
|
|
78
|
-
await queryRunner.query(`DROP TABLE IF EXISTS "batch_job_execution"`);
|
|
79
|
-
await queryRunner.query(`DROP TABLE IF EXISTS "batch_job_instance"`);
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
//# sourceMappingURL=1700000000000-CreateBatchMeta.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/migrations/1700000000000-CreateBatchMeta.ts"],"sourcesContent":["import { MigrationInterface, QueryRunner } from 'typeorm';\n\n/**\n * Creates the six batch meta-tables owned by\n * this package:\n *\n * - batch_job_instance (root, unique on (job_name, job_key))\n * - batch_job_execution (one per job run, indexed by instance)\n * - batch_step_execution (one per step run, indexed by exec)\n * - batch_job_execution_context (JSON payload + version, keyed by exec)\n * - batch_step_execution_context (JSON payload + version, keyed by step)\n *\n * This migration intentionally uses generic ANSI/PostgreSQL\n * syntax (varchar + text + timestamptz + int). The adapter\n * package's `typeorm-job-repository` is portable across SQLite\n * (test database) and PostgreSQL (production). Users targeting\n * MySQL or another driver should adjust the `down` (and\n * optionally `up`) to match their column types.\n *\n * The `params` column on `batch_job_execution` is a JSON\n * snapshot — stored as `text` to keep the schema portable and\n * always serialized, never queried structurally.\n */\nexport class CreateBatchMeta1700000000000 implements MigrationInterface {\n name = 'CreateBatchMeta1700000000000';\n\n public async up(queryRunner: QueryRunner): Promise<void> {\n await queryRunner.query(`\n CREATE TABLE IF NOT EXISTS \"batch_job_instance\" (\n \"id\" varchar(255) PRIMARY KEY,\n \"job_name\" varchar(255) NOT NULL,\n \"job_key\" varchar(255) NOT NULL,\n \"created_at\" timestamptz NOT NULL DEFAULT now(),\n CONSTRAINT \"batch_job_instance_job_name_job_key_unique\" UNIQUE (\"job_name\", \"job_key\")\n )\n `);\n\n await queryRunner.query(`\n CREATE TABLE IF NOT EXISTS \"batch_job_execution\" (\n \"id\" varchar(255) PRIMARY KEY,\n \"job_instance_id\" varchar(255) NOT NULL,\n \"status\" varchar(20) NOT NULL,\n \"start_time\" timestamptz NULL,\n \"end_time\" timestamptz NULL,\n \"exit_code\" varchar(255) NOT NULL DEFAULT '',\n \"exit_message\" text NOT NULL DEFAULT '',\n \"params\" text NOT NULL DEFAULT '{}'\n )\n `);\n await queryRunner.query(`\n CREATE INDEX IF NOT EXISTS \"batch_job_execution_job_instance_id_index\"\n ON \"batch_job_execution\" (\"job_instance_id\")\n `);\n\n await queryRunner.query(`\n CREATE TABLE IF NOT EXISTS \"batch_step_execution\" (\n \"id\" varchar(255) PRIMARY KEY,\n \"job_execution_id\" varchar(255) NOT NULL,\n \"step_name\" varchar(255) NOT NULL,\n \"status\" varchar(20) NOT NULL,\n \"read_count\" int NOT NULL DEFAULT 0,\n \"write_count\" int NOT NULL DEFAULT 0,\n \"skip_count\" int NOT NULL DEFAULT 0,\n \"rollback_count\" int NOT NULL DEFAULT 0,\n \"commit_count\" int NOT NULL DEFAULT 0,\n \"exit_code\" varchar(255) NOT NULL DEFAULT '',\n \"exit_message\" text NOT NULL DEFAULT '',\n \"created_at\" timestamptz NOT NULL DEFAULT now()\n )\n `);\n await queryRunner.query(`\n CREATE INDEX IF NOT EXISTS \"batch_step_execution_job_execution_id_index\"\n ON \"batch_step_execution\" (\"job_execution_id\")\n `);\n\n await queryRunner.query(`\n CREATE TABLE IF NOT EXISTS \"batch_job_execution_context\" (\n \"job_execution_id\" varchar(255) PRIMARY KEY,\n \"data\" text NOT NULL,\n \"version\" int NOT NULL DEFAULT 0\n )\n `);\n\n await queryRunner.query(`\n CREATE TABLE IF NOT EXISTS \"batch_step_execution_context\" (\n \"step_execution_id\" varchar(255) PRIMARY KEY,\n \"data\" text NOT NULL,\n \"version\" int NOT NULL DEFAULT 0\n )\n `);\n }\n\n public async down(queryRunner: QueryRunner): Promise<void> {\n await queryRunner.query(`DROP TABLE IF EXISTS \"batch_step_execution_context\"`);\n await queryRunner.query(`DROP TABLE IF EXISTS \"batch_job_execution_context\"`);\n await queryRunner.query(`DROP TABLE IF EXISTS \"batch_step_execution\"`);\n await queryRunner.query(`DROP TABLE IF EXISTS \"batch_job_execution\"`);\n await queryRunner.query(`DROP TABLE IF EXISTS \"batch_job_instance\"`);\n }\n}\n"],"names":["CreateBatchMeta1700000000000","name","up","queryRunner","query","down"],"mappings":";;;;+BAuBaA;;;eAAAA;;;AAAN,IAAA,AAAMA,+BAAN,MAAMA;IACXC,OAAO,+BAA+B;IAEtC,MAAaC,GAAGC,WAAwB,EAAiB;QACvD,MAAMA,YAAYC,KAAK,CAAC,CAAC;;;;;;;;IAQzB,CAAC;QAED,MAAMD,YAAYC,KAAK,CAAC,CAAC;;;;;;;;;;;IAWzB,CAAC;QACD,MAAMD,YAAYC,KAAK,CAAC,CAAC;;;IAGzB,CAAC;QAED,MAAMD,YAAYC,KAAK,CAAC,CAAC;;;;;;;;;;;;;;;IAezB,CAAC;QACD,MAAMD,YAAYC,KAAK,CAAC,CAAC;;;IAGzB,CAAC;QAED,MAAMD,YAAYC,KAAK,CAAC,CAAC;;;;;;IAMzB,CAAC;QAED,MAAMD,YAAYC,KAAK,CAAC,CAAC;;;;;;IAMzB,CAAC;IACH;IAEA,MAAaC,KAAKF,WAAwB,EAAiB;QACzD,MAAMA,YAAYC,KAAK,CAAC,CAAC,mDAAmD,CAAC;QAC7E,MAAMD,YAAYC,KAAK,CAAC,CAAC,kDAAkD,CAAC;QAC5E,MAAMD,YAAYC,KAAK,CAAC,CAAC,2CAA2C,CAAC;QACrE,MAAMD,YAAYC,KAAK,CAAC,CAAC,0CAA0C,CAAC;QACpE,MAAMD,YAAYC,KAAK,CAAC,CAAC,yCAAyC,CAAC;IACrE;AACF"}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { MigrationInterface, QueryRunner } from 'typeorm';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Creates the six batch meta-tables owned by
|
|
5
|
-
* this package:
|
|
6
|
-
*
|
|
7
|
-
* - batch_job_instance (root, unique on (job_name, job_key))
|
|
8
|
-
* - batch_job_execution (one per job run, indexed by instance)
|
|
9
|
-
* - batch_step_execution (one per step run, indexed by exec)
|
|
10
|
-
* - batch_job_execution_context (JSON payload + version, keyed by exec)
|
|
11
|
-
* - batch_step_execution_context (JSON payload + version, keyed by step)
|
|
12
|
-
*
|
|
13
|
-
* This migration intentionally uses generic ANSI/PostgreSQL
|
|
14
|
-
* syntax (varchar + text + timestamptz + int). The adapter
|
|
15
|
-
* package's `typeorm-job-repository` is portable across SQLite
|
|
16
|
-
* (test database) and PostgreSQL (production). Users targeting
|
|
17
|
-
* MySQL or another driver should adjust the `down` (and
|
|
18
|
-
* optionally `up`) to match their column types.
|
|
19
|
-
*
|
|
20
|
-
* The `params` column on `batch_job_execution` is a JSON
|
|
21
|
-
* snapshot — stored as `text` to keep the schema portable and
|
|
22
|
-
* always serialized, never queried structurally.
|
|
23
|
-
*/
|
|
24
|
-
export class CreateBatchMeta1700000000000 implements MigrationInterface {
|
|
25
|
-
name = 'CreateBatchMeta1700000000000';
|
|
26
|
-
|
|
27
|
-
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
28
|
-
await queryRunner.query(`
|
|
29
|
-
CREATE TABLE IF NOT EXISTS "batch_job_instance" (
|
|
30
|
-
"id" varchar(255) PRIMARY KEY,
|
|
31
|
-
"job_name" varchar(255) NOT NULL,
|
|
32
|
-
"job_key" varchar(255) NOT NULL,
|
|
33
|
-
"created_at" timestamptz NOT NULL DEFAULT now(),
|
|
34
|
-
CONSTRAINT "batch_job_instance_job_name_job_key_unique" UNIQUE ("job_name", "job_key")
|
|
35
|
-
)
|
|
36
|
-
`);
|
|
37
|
-
|
|
38
|
-
await queryRunner.query(`
|
|
39
|
-
CREATE TABLE IF NOT EXISTS "batch_job_execution" (
|
|
40
|
-
"id" varchar(255) PRIMARY KEY,
|
|
41
|
-
"job_instance_id" varchar(255) NOT NULL,
|
|
42
|
-
"status" varchar(20) NOT NULL,
|
|
43
|
-
"start_time" timestamptz NULL,
|
|
44
|
-
"end_time" timestamptz NULL,
|
|
45
|
-
"exit_code" varchar(255) NOT NULL DEFAULT '',
|
|
46
|
-
"exit_message" text NOT NULL DEFAULT '',
|
|
47
|
-
"params" text NOT NULL DEFAULT '{}'
|
|
48
|
-
)
|
|
49
|
-
`);
|
|
50
|
-
await queryRunner.query(`
|
|
51
|
-
CREATE INDEX IF NOT EXISTS "batch_job_execution_job_instance_id_index"
|
|
52
|
-
ON "batch_job_execution" ("job_instance_id")
|
|
53
|
-
`);
|
|
54
|
-
|
|
55
|
-
await queryRunner.query(`
|
|
56
|
-
CREATE TABLE IF NOT EXISTS "batch_step_execution" (
|
|
57
|
-
"id" varchar(255) PRIMARY KEY,
|
|
58
|
-
"job_execution_id" varchar(255) NOT NULL,
|
|
59
|
-
"step_name" varchar(255) NOT NULL,
|
|
60
|
-
"status" varchar(20) NOT NULL,
|
|
61
|
-
"read_count" int NOT NULL DEFAULT 0,
|
|
62
|
-
"write_count" int NOT NULL DEFAULT 0,
|
|
63
|
-
"skip_count" int NOT NULL DEFAULT 0,
|
|
64
|
-
"rollback_count" int NOT NULL DEFAULT 0,
|
|
65
|
-
"commit_count" int NOT NULL DEFAULT 0,
|
|
66
|
-
"exit_code" varchar(255) NOT NULL DEFAULT '',
|
|
67
|
-
"exit_message" text NOT NULL DEFAULT '',
|
|
68
|
-
"created_at" timestamptz NOT NULL DEFAULT now()
|
|
69
|
-
)
|
|
70
|
-
`);
|
|
71
|
-
await queryRunner.query(`
|
|
72
|
-
CREATE INDEX IF NOT EXISTS "batch_step_execution_job_execution_id_index"
|
|
73
|
-
ON "batch_step_execution" ("job_execution_id")
|
|
74
|
-
`);
|
|
75
|
-
|
|
76
|
-
await queryRunner.query(`
|
|
77
|
-
CREATE TABLE IF NOT EXISTS "batch_job_execution_context" (
|
|
78
|
-
"job_execution_id" varchar(255) PRIMARY KEY,
|
|
79
|
-
"data" text NOT NULL,
|
|
80
|
-
"version" int NOT NULL DEFAULT 0
|
|
81
|
-
)
|
|
82
|
-
`);
|
|
83
|
-
|
|
84
|
-
await queryRunner.query(`
|
|
85
|
-
CREATE TABLE IF NOT EXISTS "batch_step_execution_context" (
|
|
86
|
-
"step_execution_id" varchar(255) PRIMARY KEY,
|
|
87
|
-
"data" text NOT NULL,
|
|
88
|
-
"version" int NOT NULL DEFAULT 0
|
|
89
|
-
)
|
|
90
|
-
`);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
94
|
-
await queryRunner.query(`DROP TABLE IF EXISTS "batch_step_execution_context"`);
|
|
95
|
-
await queryRunner.query(`DROP TABLE IF EXISTS "batch_job_execution_context"`);
|
|
96
|
-
await queryRunner.query(`DROP TABLE IF EXISTS "batch_step_execution"`);
|
|
97
|
-
await queryRunner.query(`DROP TABLE IF EXISTS "batch_job_execution"`);
|
|
98
|
-
await queryRunner.query(`DROP TABLE IF EXISTS "batch_job_instance"`);
|
|
99
|
-
}
|
|
100
|
-
}
|