bun-query-builder 0.2.36 → 0.2.37
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/bin/cli.js +22 -11
- package/dist/src/index.js +21 -10
- package/package.json +1 -1
package/dist/bin/cli.js
CHANGED
|
@@ -19489,13 +19489,27 @@ async function resetDatabase(dir, opts = {}) {
|
|
|
19489
19489
|
const dialect = opts.dialect || config5.dialect || "postgres";
|
|
19490
19490
|
const driver = getDialectDriver(dialect);
|
|
19491
19491
|
const workspaceRoot = getWorkspaceRoot();
|
|
19492
|
+
const dropTableForReset = async (tableName) => {
|
|
19493
|
+
const dropSql = driver.dropTable(tableName);
|
|
19494
|
+
await withFreshConnection(async (bunSql2) => {
|
|
19495
|
+
if (dialect === "sqlite")
|
|
19496
|
+
await bunSql2.unsafe("PRAGMA foreign_keys = OFF").execute();
|
|
19497
|
+
if (dialect === "mysql" || dialect === "vitess")
|
|
19498
|
+
await bunSql2.unsafe("SET FOREIGN_KEY_CHECKS = 0").execute();
|
|
19499
|
+
try {
|
|
19500
|
+
await bunSql2.unsafe(dropSql).execute();
|
|
19501
|
+
} finally {
|
|
19502
|
+
if (dialect === "sqlite")
|
|
19503
|
+
await bunSql2.unsafe("PRAGMA foreign_keys = ON").execute();
|
|
19504
|
+
if (dialect === "mysql" || dialect === "vitess")
|
|
19505
|
+
await bunSql2.unsafe("SET FOREIGN_KEY_CHECKS = 1").execute();
|
|
19506
|
+
}
|
|
19507
|
+
});
|
|
19508
|
+
};
|
|
19492
19509
|
try {
|
|
19493
|
-
const dropMigrationsSql = driver.dropTable("migrations");
|
|
19494
19510
|
try {
|
|
19495
|
-
await
|
|
19496
|
-
|
|
19497
|
-
info("-- Dropped migrations table");
|
|
19498
|
-
});
|
|
19511
|
+
await dropTableForReset("migrations");
|
|
19512
|
+
info("-- Dropped migrations table");
|
|
19499
19513
|
} catch (err) {
|
|
19500
19514
|
console.error(err);
|
|
19501
19515
|
}
|
|
@@ -19526,11 +19540,8 @@ async function resetDatabase(dir, opts = {}) {
|
|
|
19526
19540
|
info(`-- Dropping ${tableNames.length} tables: ${tableNames.join(", ")}`);
|
|
19527
19541
|
for (const tableName of tableNames.reverse()) {
|
|
19528
19542
|
try {
|
|
19529
|
-
|
|
19530
|
-
|
|
19531
|
-
await bunSql2.unsafe(dropSql).execute();
|
|
19532
|
-
info(`-- Dropped table: ${tableName}`);
|
|
19533
|
-
});
|
|
19543
|
+
await dropTableForReset(tableName);
|
|
19544
|
+
info(`-- Dropped table: ${tableName}`);
|
|
19534
19545
|
} catch (err) {
|
|
19535
19546
|
console.error(err);
|
|
19536
19547
|
info(`-- Table ${tableName} may not exist, skipping drop`);
|
|
@@ -32318,7 +32329,7 @@ function getPrefix() {
|
|
|
32318
32329
|
}
|
|
32319
32330
|
var prefix = getPrefix();
|
|
32320
32331
|
// package.json
|
|
32321
|
-
var version2 = "0.2.
|
|
32332
|
+
var version2 = "0.2.37";
|
|
32322
32333
|
|
|
32323
32334
|
// bin/cli.ts
|
|
32324
32335
|
init_actions();
|
package/dist/src/index.js
CHANGED
|
@@ -19488,13 +19488,27 @@ async function resetDatabase(dir, opts = {}) {
|
|
|
19488
19488
|
const dialect = opts.dialect || config5.dialect || "postgres";
|
|
19489
19489
|
const driver = getDialectDriver(dialect);
|
|
19490
19490
|
const workspaceRoot = getWorkspaceRoot();
|
|
19491
|
+
const dropTableForReset = async (tableName) => {
|
|
19492
|
+
const dropSql = driver.dropTable(tableName);
|
|
19493
|
+
await withFreshConnection(async (bunSql2) => {
|
|
19494
|
+
if (dialect === "sqlite")
|
|
19495
|
+
await bunSql2.unsafe("PRAGMA foreign_keys = OFF").execute();
|
|
19496
|
+
if (dialect === "mysql" || dialect === "vitess")
|
|
19497
|
+
await bunSql2.unsafe("SET FOREIGN_KEY_CHECKS = 0").execute();
|
|
19498
|
+
try {
|
|
19499
|
+
await bunSql2.unsafe(dropSql).execute();
|
|
19500
|
+
} finally {
|
|
19501
|
+
if (dialect === "sqlite")
|
|
19502
|
+
await bunSql2.unsafe("PRAGMA foreign_keys = ON").execute();
|
|
19503
|
+
if (dialect === "mysql" || dialect === "vitess")
|
|
19504
|
+
await bunSql2.unsafe("SET FOREIGN_KEY_CHECKS = 1").execute();
|
|
19505
|
+
}
|
|
19506
|
+
});
|
|
19507
|
+
};
|
|
19491
19508
|
try {
|
|
19492
|
-
const dropMigrationsSql = driver.dropTable("migrations");
|
|
19493
19509
|
try {
|
|
19494
|
-
await
|
|
19495
|
-
|
|
19496
|
-
info("-- Dropped migrations table");
|
|
19497
|
-
});
|
|
19510
|
+
await dropTableForReset("migrations");
|
|
19511
|
+
info("-- Dropped migrations table");
|
|
19498
19512
|
} catch (err) {
|
|
19499
19513
|
console.error(err);
|
|
19500
19514
|
}
|
|
@@ -19525,11 +19539,8 @@ async function resetDatabase(dir, opts = {}) {
|
|
|
19525
19539
|
info(`-- Dropping ${tableNames.length} tables: ${tableNames.join(", ")}`);
|
|
19526
19540
|
for (const tableName of tableNames.reverse()) {
|
|
19527
19541
|
try {
|
|
19528
|
-
|
|
19529
|
-
|
|
19530
|
-
await bunSql2.unsafe(dropSql).execute();
|
|
19531
|
-
info(`-- Dropped table: ${tableName}`);
|
|
19532
|
-
});
|
|
19542
|
+
await dropTableForReset(tableName);
|
|
19543
|
+
info(`-- Dropped table: ${tableName}`);
|
|
19533
19544
|
} catch (err) {
|
|
19534
19545
|
console.error(err);
|
|
19535
19546
|
info(`-- Table ${tableName} may not exist, skipping drop`);
|
package/package.json
CHANGED