drizzle-kit 1.0.0-beta.2-e689d82 → 1.0.0-beta.2-0f918b0

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/bin.cjs CHANGED
@@ -164496,7 +164496,7 @@ var init_connections = __esm({
164496
164496
  }
164497
164497
  return results;
164498
164498
  };
164499
- const benchmarkQuery = async (sql, params) => {
164499
+ const benchmarkQuery = async (client, sql, params) => {
164500
164500
  const explainResult = await pool.query({
164501
164501
  text: `EXPLAIN ANALYZE ${sql}`,
164502
164502
  values: params ?? [],
@@ -164507,24 +164507,10 @@ var init_connections = __esm({
164507
164507
  const executionMatch = stringifiedResult.match(/Execution Time:\s*([\d.]+)\s*ms/i);
164508
164508
  const planningTime = Number(planningMatch[1]);
164509
164509
  const executionTime = Number(executionMatch[1]);
164510
- let startAt = 0n;
164511
- let tcpConnectedAt = 0n;
164512
- let tlsConnectedAt = null;
164513
- let dbReadyAt = 0n;
164514
164510
  let querySentAt = 0n;
164515
164511
  let firstDataAt = 0n;
164516
164512
  let lastDataAt = 0n;
164517
164513
  let bytesReceived = 0;
164518
- const client = "url" in credentials2 ? new pg.Client({ connectionString: credentials2.url }) : new pg.Client({ ...credentials2, ssl });
164519
- client.connection.once("connect", () => {
164520
- tcpConnectedAt = process.hrtime.bigint();
164521
- });
164522
- client.connection.prependOnceListener("sslconnect", () => {
164523
- tlsConnectedAt = process.hrtime.bigint();
164524
- });
164525
- client.connection.prependOnceListener("readyForQuery", () => {
164526
- dbReadyAt = process.hrtime.bigint();
164527
- });
164528
164514
  client.connection.addListener("rowDescription", (data2) => {
164529
164515
  if (firstDataAt === 0n) {
164530
164516
  firstDataAt = process.hrtime.bigint();
@@ -164537,29 +164523,48 @@ var init_connections = __esm({
164537
164523
  client.connection.addListener("commandComplete", () => {
164538
164524
  lastDataAt = process.hrtime.bigint();
164539
164525
  });
164540
- startAt = process.hrtime.bigint();
164541
- await client.connect();
164542
164526
  querySentAt = process.hrtime.bigint();
164543
164527
  await client.query(sql, params);
164544
- await client.end();
164528
+ client.connection.removeAllListeners("rowDescription");
164529
+ client.connection.removeAllListeners("dataRow");
164530
+ client.connection.removeAllListeners("commandComplete");
164545
164531
  return {
164546
- tcpHandshake: ms(startAt, tcpConnectedAt),
164547
- tlsHandshake: tlsConnectedAt ? ms(tcpConnectedAt, tlsConnectedAt) : null,
164548
- dbHandshake: ms(tlsConnectedAt ?? tcpConnectedAt, dbReadyAt),
164549
164532
  planning: planningTime,
164550
164533
  execution: executionTime,
164551
164534
  dataDownload: ms(firstDataAt, lastDataAt) + ms(querySentAt, firstDataAt) - executionTime - planningTime,
164552
- total: ms(startAt, lastDataAt),
164535
+ total: ms(querySentAt, lastDataAt),
164553
164536
  dataSize: bytesReceived
164554
164537
  };
164555
164538
  };
164556
164539
  const benchmarkProxy = async ({ sql, params }, repeats) => {
164540
+ let startAt = 0n;
164541
+ let tcpConnectedAt = 0n;
164542
+ let tlsConnectedAt = null;
164543
+ let dbReadyAt = 0n;
164544
+ const client = "url" in credentials2 ? new pg.Client({ connectionString: credentials2.url }) : new pg.Client({ ...credentials2, ssl });
164545
+ client.connection.once("connect", () => {
164546
+ tcpConnectedAt = process.hrtime.bigint();
164547
+ });
164548
+ client.connection.prependOnceListener("sslconnect", () => {
164549
+ tlsConnectedAt = process.hrtime.bigint();
164550
+ });
164551
+ client.connection.prependOnceListener("readyForQuery", () => {
164552
+ dbReadyAt = process.hrtime.bigint();
164553
+ });
164554
+ startAt = process.hrtime.bigint();
164555
+ await client.connect();
164557
164556
  const results = [];
164558
164557
  for (let i6 = 0; i6 < repeats; i6++) {
164559
- const r6 = await benchmarkQuery(sql, params);
164558
+ const r6 = await benchmarkQuery(client, sql, params);
164560
164559
  results.push(r6);
164561
164560
  }
164562
- return results;
164561
+ await client.end();
164562
+ return {
164563
+ tcpHandshake: ms(startAt, tcpConnectedAt),
164564
+ tlsHandshake: tlsConnectedAt ? ms(tcpConnectedAt, tlsConnectedAt) : null,
164565
+ dbHandshake: ms(tlsConnectedAt ?? tcpConnectedAt, dbReadyAt),
164566
+ queries: results
164567
+ };
164563
164568
  };
164564
164569
  return { packageName: "pg", query, proxy, transactionProxy, benchmarkProxy, migrate: migrateFn };
164565
164570
  }
@@ -165095,8 +165100,7 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
165095
165100
  }
165096
165101
  return results;
165097
165102
  };
165098
- const benchmarkQuery = async (sql, params) => {
165099
- const { createConnection: createConnection2 } = await import("mysql2");
165103
+ const benchmarkQuery = async (newConnection, sql, params) => {
165100
165104
  const explainResult = await connection.query({
165101
165105
  sql: `EXPLAIN ANALYZE ${sql}`,
165102
165106
  values: params ?? [],
@@ -165108,13 +165112,45 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
165108
165112
  );
165109
165113
  const lastRowTime = Number(timeMatch[2]);
165110
165114
  const executionTime = lastRowTime;
165111
- let startAt = 0n;
165112
- let tcpConnectedAt = 0n;
165113
- let tlsConnectedAt = null;
165114
165115
  let querySentAt = 0n;
165115
165116
  let firstDataAt = 0n;
165116
165117
  let lastDataAt = 0n;
165117
165118
  let bytesReceived = 0;
165119
+ querySentAt = process.hrtime.bigint();
165120
+ await new Promise((resolve3, reject) => {
165121
+ const query2 = newConnection.query({
165122
+ sql,
165123
+ values: params ?? [],
165124
+ typeCast
165125
+ // rowsAsArray: true,
165126
+ });
165127
+ query2.on("error", (err2) => {
165128
+ reject(err2);
165129
+ });
165130
+ query2.on("fields", (fields) => {
165131
+ if (firstDataAt === 0n) {
165132
+ firstDataAt = process.hrtime.bigint();
165133
+ }
165134
+ bytesReceived += fields[0]._buf.length;
165135
+ });
165136
+ query2.on("end", () => {
165137
+ lastDataAt = process.hrtime.bigint();
165138
+ resolve3();
165139
+ });
165140
+ });
165141
+ return {
165142
+ planning: null,
165143
+ execution: executionTime,
165144
+ dataDownload: ms(firstDataAt, lastDataAt) + ms(querySentAt, firstDataAt) - executionTime,
165145
+ total: ms(querySentAt, lastDataAt),
165146
+ dataSize: bytesReceived
165147
+ };
165148
+ };
165149
+ const benchmarkProxy = async ({ sql, params }, repeats) => {
165150
+ const { createConnection: createConnection2 } = await import("mysql2");
165151
+ let startAt = 0n;
165152
+ let tcpConnectedAt = 0n;
165153
+ let tlsConnectedAt = null;
165118
165154
  const createStream = ({ config }) => {
165119
165155
  let stream;
165120
165156
  if (config.socketPath) {
@@ -165134,8 +165170,7 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
165134
165170
  return stream;
165135
165171
  };
165136
165172
  startAt = process.hrtime.bigint();
165137
- const newConnection = result2.url ? createConnection2({
165138
- // debug: true,
165173
+ const connection2 = result2.url ? createConnection2({
165139
165174
  uri: result2.url,
165140
165175
  stream: createStream
165141
165176
  }) : createConnection2({
@@ -165143,7 +165178,7 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
165143
165178
  stream: createStream
165144
165179
  });
165145
165180
  await new Promise((resolve3, reject) => {
165146
- newConnection.connect((err2) => {
165181
+ connection2.connect((err2) => {
165147
165182
  tlsConnectedAt = process.hrtime.bigint();
165148
165183
  if (err2) {
165149
165184
  reject(err2);
@@ -165152,48 +165187,19 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
165152
165187
  }
165153
165188
  });
165154
165189
  });
165155
- querySentAt = process.hrtime.bigint();
165156
- await new Promise((resolve3, reject) => {
165157
- const query2 = newConnection.query({
165158
- sql,
165159
- values: params ?? [],
165160
- typeCast
165161
- // rowsAsArray: true,
165162
- });
165163
- query2.on("error", (err2) => {
165164
- reject(err2);
165165
- });
165166
- query2.on("fields", (fields) => {
165167
- if (firstDataAt === 0n) {
165168
- firstDataAt = process.hrtime.bigint();
165169
- }
165170
- bytesReceived += fields[0]._buf.length;
165171
- });
165172
- query2.on("end", () => {
165173
- lastDataAt = process.hrtime.bigint();
165174
- resolve3();
165175
- newConnection.end();
165176
- });
165177
- });
165190
+ const results = [];
165191
+ for (let i6 = 0; i6 < repeats; i6++) {
165192
+ const r6 = await benchmarkQuery(connection2, sql, params);
165193
+ results.push(r6);
165194
+ }
165195
+ connection2.end();
165178
165196
  return {
165179
165197
  tcpHandshake: ms(startAt, tcpConnectedAt),
165180
165198
  tlsHandshake: tlsConnectedAt ? ms(tcpConnectedAt, tlsConnectedAt) : null,
165181
165199
  dbHandshake: null,
165182
- planning: null,
165183
- execution: executionTime,
165184
- dataDownload: ms(firstDataAt, lastDataAt) + ms(querySentAt, firstDataAt) - executionTime,
165185
- total: ms(startAt, lastDataAt),
165186
- dataSize: bytesReceived
165200
+ queries: results
165187
165201
  };
165188
165202
  };
165189
- const benchmarkProxy = async ({ sql, params }, repeats) => {
165190
- const results = [];
165191
- for (let i6 = 0; i6 < repeats; i6++) {
165192
- const r6 = await benchmarkQuery(sql, params);
165193
- results.push(r6);
165194
- }
165195
- return results;
165196
- };
165197
165203
  return {
165198
165204
  db: { query },
165199
165205
  packageName: "mysql2",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-kit",
3
- "version": "1.0.0-beta.2-e689d82",
3
+ "version": "1.0.0-beta.2-0f918b0",
4
4
  "homepage": "https://orm.drizzle.team",
5
5
  "keywords": [
6
6
  "drizzle",