metal-orm 1.1.10 → 1.1.11
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/dist/index.cjs +106 -43
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +106 -43
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/scripts/generate-entities/render.mjs +21 -12
- package/scripts/generate-entities/schema.mjs +87 -73
- package/scripts/generate-entities/tree-detection.mjs +67 -61
- package/src/bulk/bulk-delete-executor.ts +3 -5
- package/src/bulk/bulk-insert-executor.ts +7 -7
- package/src/bulk/bulk-update-executor.ts +2 -2
- package/src/bulk/bulk-upsert-executor.ts +5 -7
- package/src/core/ddl/introspect/mysql.ts +113 -36
- package/src/core/execution/executors/better-sqlite3-executor.ts +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -8438,7 +8438,7 @@ interface BetterSqlite3Statement {
|
|
|
8438
8438
|
}
|
|
8439
8439
|
interface BetterSqlite3ClientLike {
|
|
8440
8440
|
prepare(sql: string): BetterSqlite3Statement;
|
|
8441
|
-
transaction<T extends (...args:
|
|
8441
|
+
transaction<T extends (...args: unknown[]) => unknown>(fn: T): T;
|
|
8442
8442
|
}
|
|
8443
8443
|
/**
|
|
8444
8444
|
* Creates a database executor for better-sqlite3.
|
|
@@ -10370,7 +10370,7 @@ interface InsertExecutorOptions extends BulkExecutorOptions {
|
|
|
10370
10370
|
}
|
|
10371
10371
|
declare class BulkInsertExecutor extends BulkBaseExecutor<InsertExecutorOptions> {
|
|
10372
10372
|
constructor(session: OrmSession, table: TableDef, rows: InsertRow[], options?: BulkInsertOptions);
|
|
10373
|
-
protected executeChunk(chunk: InsertRow[],
|
|
10373
|
+
protected executeChunk(chunk: InsertRow[], _chunkIndex: number): Promise<ChunkOutcome>;
|
|
10374
10374
|
}
|
|
10375
10375
|
declare function bulkInsert<TTable extends TableDef>(session: OrmSession, table: TTable, rows: InsertRow[], options?: BulkInsertOptions): Promise<BulkResult>;
|
|
10376
10376
|
|
|
@@ -10382,7 +10382,7 @@ interface UpdateExecutorOptions extends BulkExecutorOptions {
|
|
|
10382
10382
|
declare class BulkUpdateExecutor extends BulkBaseExecutor<UpdateExecutorOptions> {
|
|
10383
10383
|
private readonly byColumns;
|
|
10384
10384
|
constructor(session: OrmSession, table: TableDef, rows: UpdateRow[], options?: BulkUpdateOptions);
|
|
10385
|
-
protected executeChunk(chunk: UpdateRow[],
|
|
10385
|
+
protected executeChunk(chunk: UpdateRow[], _chunkIndex: number): Promise<ChunkOutcome>;
|
|
10386
10386
|
}
|
|
10387
10387
|
declare function bulkUpdate<TTable extends TableDef>(session: OrmSession, table: TTable, rows: UpdateRow[], options?: BulkUpdateOptions): Promise<BulkResult>;
|
|
10388
10388
|
declare function bulkUpdateWhere<TTable extends TableDef>(session: OrmSession, table: TTable, ids: ValueOperandInput[], set: Record<string, ValueOperandInput>, options?: Omit<BulkUpdateOptions, 'by' | 'returning'> & {
|
|
@@ -10397,7 +10397,7 @@ interface DeleteExecutorOptions extends BulkExecutorOptions {
|
|
|
10397
10397
|
declare class BulkDeleteExecutor extends BulkBaseExecutor<DeleteExecutorOptions> {
|
|
10398
10398
|
private readonly byColumnName;
|
|
10399
10399
|
constructor(session: OrmSession, table: TableDef, ids: ValueOperandInput[], options?: BulkDeleteOptions);
|
|
10400
|
-
protected executeChunk(chunk: ValueOperandInput[],
|
|
10400
|
+
protected executeChunk(chunk: ValueOperandInput[], _chunkIndex: number): Promise<ChunkOutcome>;
|
|
10401
10401
|
}
|
|
10402
10402
|
declare function bulkDelete<TTable extends TableDef>(session: OrmSession, table: TTable, ids: ValueOperandInput[], options?: BulkDeleteOptions): Promise<BulkResult>;
|
|
10403
10403
|
declare function bulkDeleteWhere<TTable extends TableDef>(session: OrmSession, table: TTable, where: ExpressionNode, options?: Pick<BulkDeleteOptions, 'transactional'>): Promise<BulkResult>;
|
|
@@ -10411,7 +10411,7 @@ declare class BulkUpsertExecutor extends BulkBaseExecutor<UpsertExecutorOptions>
|
|
|
10411
10411
|
private readonly conflictTargetNodes;
|
|
10412
10412
|
private readonly updateColumns;
|
|
10413
10413
|
constructor(session: OrmSession, table: TableDef, rows: InsertRow[], options?: BulkUpsertOptions);
|
|
10414
|
-
protected executeChunk(chunk: InsertRow[],
|
|
10414
|
+
protected executeChunk(chunk: InsertRow[], _chunkIndex: number): Promise<ChunkOutcome>;
|
|
10415
10415
|
}
|
|
10416
10416
|
declare function bulkUpsert<TTable extends TableDef>(session: OrmSession, table: TTable, rows: InsertRow[], options?: BulkUpsertOptions): Promise<BulkResult>;
|
|
10417
10417
|
|
package/dist/index.d.ts
CHANGED
|
@@ -8438,7 +8438,7 @@ interface BetterSqlite3Statement {
|
|
|
8438
8438
|
}
|
|
8439
8439
|
interface BetterSqlite3ClientLike {
|
|
8440
8440
|
prepare(sql: string): BetterSqlite3Statement;
|
|
8441
|
-
transaction<T extends (...args:
|
|
8441
|
+
transaction<T extends (...args: unknown[]) => unknown>(fn: T): T;
|
|
8442
8442
|
}
|
|
8443
8443
|
/**
|
|
8444
8444
|
* Creates a database executor for better-sqlite3.
|
|
@@ -10370,7 +10370,7 @@ interface InsertExecutorOptions extends BulkExecutorOptions {
|
|
|
10370
10370
|
}
|
|
10371
10371
|
declare class BulkInsertExecutor extends BulkBaseExecutor<InsertExecutorOptions> {
|
|
10372
10372
|
constructor(session: OrmSession, table: TableDef, rows: InsertRow[], options?: BulkInsertOptions);
|
|
10373
|
-
protected executeChunk(chunk: InsertRow[],
|
|
10373
|
+
protected executeChunk(chunk: InsertRow[], _chunkIndex: number): Promise<ChunkOutcome>;
|
|
10374
10374
|
}
|
|
10375
10375
|
declare function bulkInsert<TTable extends TableDef>(session: OrmSession, table: TTable, rows: InsertRow[], options?: BulkInsertOptions): Promise<BulkResult>;
|
|
10376
10376
|
|
|
@@ -10382,7 +10382,7 @@ interface UpdateExecutorOptions extends BulkExecutorOptions {
|
|
|
10382
10382
|
declare class BulkUpdateExecutor extends BulkBaseExecutor<UpdateExecutorOptions> {
|
|
10383
10383
|
private readonly byColumns;
|
|
10384
10384
|
constructor(session: OrmSession, table: TableDef, rows: UpdateRow[], options?: BulkUpdateOptions);
|
|
10385
|
-
protected executeChunk(chunk: UpdateRow[],
|
|
10385
|
+
protected executeChunk(chunk: UpdateRow[], _chunkIndex: number): Promise<ChunkOutcome>;
|
|
10386
10386
|
}
|
|
10387
10387
|
declare function bulkUpdate<TTable extends TableDef>(session: OrmSession, table: TTable, rows: UpdateRow[], options?: BulkUpdateOptions): Promise<BulkResult>;
|
|
10388
10388
|
declare function bulkUpdateWhere<TTable extends TableDef>(session: OrmSession, table: TTable, ids: ValueOperandInput[], set: Record<string, ValueOperandInput>, options?: Omit<BulkUpdateOptions, 'by' | 'returning'> & {
|
|
@@ -10397,7 +10397,7 @@ interface DeleteExecutorOptions extends BulkExecutorOptions {
|
|
|
10397
10397
|
declare class BulkDeleteExecutor extends BulkBaseExecutor<DeleteExecutorOptions> {
|
|
10398
10398
|
private readonly byColumnName;
|
|
10399
10399
|
constructor(session: OrmSession, table: TableDef, ids: ValueOperandInput[], options?: BulkDeleteOptions);
|
|
10400
|
-
protected executeChunk(chunk: ValueOperandInput[],
|
|
10400
|
+
protected executeChunk(chunk: ValueOperandInput[], _chunkIndex: number): Promise<ChunkOutcome>;
|
|
10401
10401
|
}
|
|
10402
10402
|
declare function bulkDelete<TTable extends TableDef>(session: OrmSession, table: TTable, ids: ValueOperandInput[], options?: BulkDeleteOptions): Promise<BulkResult>;
|
|
10403
10403
|
declare function bulkDeleteWhere<TTable extends TableDef>(session: OrmSession, table: TTable, where: ExpressionNode, options?: Pick<BulkDeleteOptions, 'transactional'>): Promise<BulkResult>;
|
|
@@ -10411,7 +10411,7 @@ declare class BulkUpsertExecutor extends BulkBaseExecutor<UpsertExecutorOptions>
|
|
|
10411
10411
|
private readonly conflictTargetNodes;
|
|
10412
10412
|
private readonly updateColumns;
|
|
10413
10413
|
constructor(session: OrmSession, table: TableDef, rows: InsertRow[], options?: BulkUpsertOptions);
|
|
10414
|
-
protected executeChunk(chunk: InsertRow[],
|
|
10414
|
+
protected executeChunk(chunk: InsertRow[], _chunkIndex: number): Promise<ChunkOutcome>;
|
|
10415
10415
|
}
|
|
10416
10416
|
declare function bulkUpsert<TTable extends TableDef>(session: OrmSession, table: TTable, rows: InsertRow[], options?: BulkUpsertOptions): Promise<BulkResult>;
|
|
10417
10417
|
|
package/dist/index.js
CHANGED
|
@@ -11921,6 +11921,25 @@ var databaseFunction = {
|
|
|
11921
11921
|
fn: "DATABASE",
|
|
11922
11922
|
args: []
|
|
11923
11923
|
};
|
|
11924
|
+
var readMysqlField = (row, field) => {
|
|
11925
|
+
const record = row;
|
|
11926
|
+
if (Object.prototype.hasOwnProperty.call(record, field)) {
|
|
11927
|
+
return record[field];
|
|
11928
|
+
}
|
|
11929
|
+
const lower2 = field.toLowerCase();
|
|
11930
|
+
if (lower2 !== field && Object.prototype.hasOwnProperty.call(record, lower2)) {
|
|
11931
|
+
return record[lower2];
|
|
11932
|
+
}
|
|
11933
|
+
const upper2 = field.toUpperCase();
|
|
11934
|
+
if (upper2 !== field && Object.prototype.hasOwnProperty.call(record, upper2)) {
|
|
11935
|
+
return record[upper2];
|
|
11936
|
+
}
|
|
11937
|
+
return void 0;
|
|
11938
|
+
};
|
|
11939
|
+
var readMysqlStringField = (row, field) => {
|
|
11940
|
+
const value = readMysqlField(row, field);
|
|
11941
|
+
return typeof value === "string" ? value : void 0;
|
|
11942
|
+
};
|
|
11924
11943
|
var mysqlIntrospector = {
|
|
11925
11944
|
async introspect(ctx, options) {
|
|
11926
11945
|
const schema = options.schema;
|
|
@@ -12062,39 +12081,68 @@ var mysqlIntrospector = {
|
|
|
12062
12081
|
const indexRows = await runSelectNode(indexQuery, ctx);
|
|
12063
12082
|
const tableComments = /* @__PURE__ */ new Map();
|
|
12064
12083
|
tableRows.forEach((r) => {
|
|
12065
|
-
const
|
|
12066
|
-
|
|
12067
|
-
|
|
12084
|
+
const tableSchema = readMysqlStringField(r, "table_schema");
|
|
12085
|
+
const tableName = readMysqlStringField(r, "table_name");
|
|
12086
|
+
const tableComment = readMysqlStringField(r, "table_comment");
|
|
12087
|
+
if (!tableSchema || !tableName) return;
|
|
12088
|
+
const key = `${tableSchema}.${tableName}`;
|
|
12089
|
+
if (tableComment) {
|
|
12090
|
+
tableComments.set(key, tableComment);
|
|
12068
12091
|
}
|
|
12069
12092
|
});
|
|
12070
12093
|
const pkMap = /* @__PURE__ */ new Map();
|
|
12071
12094
|
pkRows.forEach((r) => {
|
|
12072
|
-
const
|
|
12095
|
+
const tableSchema = readMysqlStringField(r, "table_schema");
|
|
12096
|
+
const tableName = readMysqlStringField(r, "table_name");
|
|
12097
|
+
const columnName = readMysqlStringField(r, "column_name");
|
|
12098
|
+
if (!tableSchema || !tableName || !columnName) return;
|
|
12099
|
+
const key = `${tableSchema}.${tableName}`;
|
|
12073
12100
|
const list = pkMap.get(key) || [];
|
|
12074
|
-
list.push(
|
|
12101
|
+
list.push(columnName);
|
|
12075
12102
|
pkMap.set(key, list);
|
|
12076
12103
|
});
|
|
12077
12104
|
const fkMap = /* @__PURE__ */ new Map();
|
|
12078
12105
|
fkRows.forEach((r) => {
|
|
12079
|
-
const
|
|
12106
|
+
const tableSchema = readMysqlStringField(r, "table_schema");
|
|
12107
|
+
const tableName = readMysqlStringField(r, "table_name");
|
|
12108
|
+
const columnName = readMysqlStringField(r, "column_name");
|
|
12109
|
+
const constraintName = readMysqlStringField(r, "constraint_name");
|
|
12110
|
+
const referencedTableSchema = readMysqlStringField(r, "referenced_table_schema");
|
|
12111
|
+
const referencedTableName = readMysqlStringField(r, "referenced_table_name");
|
|
12112
|
+
const referencedColumnName = readMysqlStringField(r, "referenced_column_name");
|
|
12113
|
+
const deleteRule = readMysqlStringField(r, "delete_rule");
|
|
12114
|
+
const updateRule = readMysqlStringField(r, "update_rule");
|
|
12115
|
+
if (!tableSchema || !tableName || !columnName || !constraintName || !referencedTableSchema || !referencedTableName || !referencedColumnName) {
|
|
12116
|
+
return;
|
|
12117
|
+
}
|
|
12118
|
+
const key = `${tableSchema}.${tableName}.${columnName}`;
|
|
12080
12119
|
const list = fkMap.get(key) || [];
|
|
12081
12120
|
list.push({
|
|
12082
|
-
table: `${
|
|
12083
|
-
column:
|
|
12084
|
-
onDelete:
|
|
12085
|
-
onUpdate:
|
|
12086
|
-
name:
|
|
12121
|
+
table: `${referencedTableSchema}.${referencedTableName}`,
|
|
12122
|
+
column: referencedColumnName,
|
|
12123
|
+
onDelete: deleteRule,
|
|
12124
|
+
onUpdate: updateRule,
|
|
12125
|
+
name: constraintName
|
|
12087
12126
|
});
|
|
12088
12127
|
fkMap.set(key, list);
|
|
12089
12128
|
});
|
|
12090
12129
|
const tablesByKey = /* @__PURE__ */ new Map();
|
|
12091
12130
|
columnRows.forEach((r) => {
|
|
12092
|
-
const
|
|
12093
|
-
|
|
12131
|
+
const tableSchema = readMysqlStringField(r, "table_schema");
|
|
12132
|
+
const tableName = readMysqlStringField(r, "table_name");
|
|
12133
|
+
const columnName = readMysqlStringField(r, "column_name");
|
|
12134
|
+
const columnType = readMysqlStringField(r, "column_type") || readMysqlStringField(r, "data_type");
|
|
12135
|
+
const isNullable = readMysqlStringField(r, "is_nullable");
|
|
12136
|
+
const columnDefault = readMysqlField(r, "column_default");
|
|
12137
|
+
const extra = readMysqlStringField(r, "extra");
|
|
12138
|
+
const columnComment = readMysqlStringField(r, "column_comment");
|
|
12139
|
+
if (!tableSchema || !tableName || !columnName || !columnType || !isNullable) return;
|
|
12140
|
+
const key = `${tableSchema}.${tableName}`;
|
|
12141
|
+
if (!shouldIncludeTable(tableName, options)) return;
|
|
12094
12142
|
if (!tablesByKey.has(key)) {
|
|
12095
12143
|
tablesByKey.set(key, {
|
|
12096
|
-
name:
|
|
12097
|
-
schema:
|
|
12144
|
+
name: tableName,
|
|
12145
|
+
schema: tableSchema,
|
|
12098
12146
|
columns: [],
|
|
12099
12147
|
primaryKey: pkMap.get(key) || [],
|
|
12100
12148
|
indexes: [],
|
|
@@ -12102,17 +12150,16 @@ var mysqlIntrospector = {
|
|
|
12102
12150
|
});
|
|
12103
12151
|
}
|
|
12104
12152
|
const table = tablesByKey.get(key);
|
|
12105
|
-
const
|
|
12106
|
-
const comment = r.column_comment?.trim() ? r.column_comment : void 0;
|
|
12153
|
+
const comment = columnComment?.trim() ? columnComment : void 0;
|
|
12107
12154
|
const column = {
|
|
12108
|
-
name:
|
|
12155
|
+
name: columnName,
|
|
12109
12156
|
type: columnType,
|
|
12110
|
-
notNull:
|
|
12111
|
-
default:
|
|
12112
|
-
autoIncrement: typeof
|
|
12157
|
+
notNull: isNullable === "NO",
|
|
12158
|
+
default: columnDefault ?? void 0,
|
|
12159
|
+
autoIncrement: typeof extra === "string" && extra.includes("auto_increment"),
|
|
12113
12160
|
comment
|
|
12114
12161
|
};
|
|
12115
|
-
const fk = fkMap.get(`${key}.${
|
|
12162
|
+
const fk = fkMap.get(`${key}.${columnName}`)?.[0];
|
|
12116
12163
|
if (fk) {
|
|
12117
12164
|
column.references = {
|
|
12118
12165
|
table: fk.table,
|
|
@@ -12125,14 +12172,20 @@ var mysqlIntrospector = {
|
|
|
12125
12172
|
table.columns.push(column);
|
|
12126
12173
|
});
|
|
12127
12174
|
indexRows.forEach((r) => {
|
|
12128
|
-
const
|
|
12175
|
+
const tableSchema = readMysqlStringField(r, "table_schema");
|
|
12176
|
+
const tableName = readMysqlStringField(r, "table_name");
|
|
12177
|
+
const indexName = readMysqlStringField(r, "index_name");
|
|
12178
|
+
const nonUnique = readMysqlField(r, "non_unique");
|
|
12179
|
+
const colsValue = readMysqlField(r, "cols");
|
|
12180
|
+
if (!tableSchema || !tableName || !indexName) return;
|
|
12181
|
+
const key = `${tableSchema}.${tableName}`;
|
|
12129
12182
|
const table = tablesByKey.get(key);
|
|
12130
12183
|
if (!table) return;
|
|
12131
|
-
const cols = (typeof
|
|
12184
|
+
const cols = (typeof colsValue === "string" ? colsValue.split(",") : []).map((c) => ({ column: c.trim() }));
|
|
12132
12185
|
const idx = {
|
|
12133
|
-
name:
|
|
12186
|
+
name: indexName,
|
|
12134
12187
|
columns: cols,
|
|
12135
|
-
unique:
|
|
12188
|
+
unique: Number(nonUnique) === 0
|
|
12136
12189
|
};
|
|
12137
12190
|
table.indexes = table.indexes || [];
|
|
12138
12191
|
table.indexes.push(idx);
|
|
@@ -12194,25 +12247,35 @@ var mysqlIntrospector = {
|
|
|
12194
12247
|
const viewColumnRows = await runSelectNode(viewColumnsQuery, ctx);
|
|
12195
12248
|
const viewsByKey = /* @__PURE__ */ new Map();
|
|
12196
12249
|
for (const r of viewRows) {
|
|
12197
|
-
|
|
12198
|
-
const
|
|
12250
|
+
const tableSchema = readMysqlStringField(r, "table_schema");
|
|
12251
|
+
const tableName = readMysqlStringField(r, "table_name");
|
|
12252
|
+
const viewDefinition = readMysqlStringField(r, "view_definition");
|
|
12253
|
+
if (!tableSchema || !tableName) continue;
|
|
12254
|
+
if (!shouldIncludeView(tableName, options)) continue;
|
|
12255
|
+
const key = `${tableSchema}.${tableName}`;
|
|
12199
12256
|
viewsByKey.set(key, {
|
|
12200
|
-
name:
|
|
12201
|
-
schema:
|
|
12257
|
+
name: tableName,
|
|
12258
|
+
schema: tableSchema,
|
|
12202
12259
|
columns: [],
|
|
12203
|
-
definition:
|
|
12260
|
+
definition: viewDefinition || void 0
|
|
12204
12261
|
});
|
|
12205
12262
|
}
|
|
12206
12263
|
for (const r of viewColumnRows) {
|
|
12207
|
-
const
|
|
12264
|
+
const tableSchema = readMysqlStringField(r, "table_schema");
|
|
12265
|
+
const tableName = readMysqlStringField(r, "table_name");
|
|
12266
|
+
const columnName = readMysqlStringField(r, "column_name");
|
|
12267
|
+
const columnType = readMysqlStringField(r, "column_type") || readMysqlStringField(r, "data_type");
|
|
12268
|
+
const isNullable = readMysqlStringField(r, "is_nullable");
|
|
12269
|
+
const columnComment = readMysqlStringField(r, "column_comment");
|
|
12270
|
+
if (!tableSchema || !tableName || !columnName || !columnType || !isNullable) continue;
|
|
12271
|
+
const key = `${tableSchema}.${tableName}`;
|
|
12208
12272
|
const view = viewsByKey.get(key);
|
|
12209
12273
|
if (!view) continue;
|
|
12210
|
-
const columnType = r.column_type || r.data_type;
|
|
12211
12274
|
const column = {
|
|
12212
|
-
name:
|
|
12275
|
+
name: columnName,
|
|
12213
12276
|
type: columnType,
|
|
12214
|
-
notNull:
|
|
12215
|
-
comment:
|
|
12277
|
+
notNull: isNullable === "NO",
|
|
12278
|
+
comment: columnComment?.trim() || void 0
|
|
12216
12279
|
};
|
|
12217
12280
|
view.columns.push(column);
|
|
12218
12281
|
}
|
|
@@ -21278,21 +21341,21 @@ var BulkInsertExecutor = class extends BulkBaseExecutor {
|
|
|
21278
21341
|
constructor(session, table, rows, options = {}) {
|
|
21279
21342
|
super(session, table, rows, options);
|
|
21280
21343
|
}
|
|
21281
|
-
async executeChunk(chunk,
|
|
21344
|
+
async executeChunk(chunk, _chunkIndex) {
|
|
21282
21345
|
const returningColumns = resolveReturningColumns(this.ctx, this.table, this.options.returning);
|
|
21283
21346
|
let builder = new InsertQueryBuilder(this.table).values(chunk);
|
|
21284
21347
|
if (this.options.onConflict) {
|
|
21285
21348
|
const conflictColumns = this.options.onConflict.target?.columns ?? [];
|
|
21286
|
-
|
|
21349
|
+
const conflictBuilder = builder.onConflict(conflictColumns);
|
|
21287
21350
|
if (this.options.onConflict.action.type === "DoNothing") {
|
|
21288
|
-
builder =
|
|
21351
|
+
builder = conflictBuilder.doNothing();
|
|
21289
21352
|
} else if (this.options.onConflict.action.type === "DoUpdate" && this.options.onConflict.action.set) {
|
|
21290
21353
|
const setMap = {};
|
|
21291
21354
|
for (const assignment of this.options.onConflict.action.set) {
|
|
21292
21355
|
const colName = typeof assignment.column === "object" ? assignment.column.name : assignment.column;
|
|
21293
21356
|
setMap[colName] = assignment.value;
|
|
21294
21357
|
}
|
|
21295
|
-
builder =
|
|
21358
|
+
builder = conflictBuilder.doUpdate(setMap);
|
|
21296
21359
|
}
|
|
21297
21360
|
}
|
|
21298
21361
|
const finalBuilder = builder;
|
|
@@ -21327,7 +21390,7 @@ var BulkUpdateExecutor = class extends BulkBaseExecutor {
|
|
|
21327
21390
|
super(session, table, rows, options);
|
|
21328
21391
|
this.byColumns = resolveByColumns(table, options.by);
|
|
21329
21392
|
}
|
|
21330
|
-
async executeChunk(chunk,
|
|
21393
|
+
async executeChunk(chunk, _chunkIndex) {
|
|
21331
21394
|
const allReturning = [];
|
|
21332
21395
|
const returningColumns = resolveReturningColumns(this.ctx, this.table, this.options.returning);
|
|
21333
21396
|
const extraWhere = this.options.where;
|
|
@@ -21447,7 +21510,7 @@ var BulkDeleteExecutor = class extends BulkBaseExecutor {
|
|
|
21447
21510
|
super(session, table, ids, options);
|
|
21448
21511
|
this.byColumnName = options.by ?? findPrimaryKey(table);
|
|
21449
21512
|
}
|
|
21450
|
-
async executeChunk(chunk,
|
|
21513
|
+
async executeChunk(chunk, _chunkIndex) {
|
|
21451
21514
|
const byColumn = this.table.columns[this.byColumnName];
|
|
21452
21515
|
if (!byColumn) {
|
|
21453
21516
|
throw new Error(
|
|
@@ -21503,7 +21566,7 @@ var BulkUpsertExecutor = class extends BulkBaseExecutor {
|
|
|
21503
21566
|
const conflictSet = new Set(conflictTargetNames);
|
|
21504
21567
|
this.updateColumns = options.updateColumns ?? Object.keys(rows[0] ?? {}).filter((col2) => !conflictSet.has(col2) && col2 in table.columns);
|
|
21505
21568
|
}
|
|
21506
|
-
async executeChunk(chunk,
|
|
21569
|
+
async executeChunk(chunk, _chunkIndex) {
|
|
21507
21570
|
const returningColumns = resolveReturningColumns(this.ctx, this.table, this.options.returning);
|
|
21508
21571
|
const set = {};
|
|
21509
21572
|
for (const col2 of this.updateColumns) {
|