bun-query-builder 0.1.60 → 0.1.62
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 +10 -4
- package/dist/src/index.js +9 -3
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
package/dist/bin/cli.js
CHANGED
|
@@ -11704,6 +11704,7 @@ var init_config = __esm(() => {
|
|
|
11704
11704
|
init_dist();
|
|
11705
11705
|
defaultConfig4 = {
|
|
11706
11706
|
verbose: true,
|
|
11707
|
+
snapshotDir: ".qb",
|
|
11707
11708
|
dialect: "postgres",
|
|
11708
11709
|
database: {
|
|
11709
11710
|
database: "test_db",
|
|
@@ -18598,9 +18599,11 @@ function info(message) {
|
|
|
18598
18599
|
if (config5.verbose)
|
|
18599
18600
|
console.log(message);
|
|
18600
18601
|
}
|
|
18602
|
+
function getSnapshotDir(workspaceRoot) {
|
|
18603
|
+
return join9(workspaceRoot, config5.snapshotDir || ".qb");
|
|
18604
|
+
}
|
|
18601
18605
|
function getSnapshotPath(workspaceRoot, dialect) {
|
|
18602
|
-
|
|
18603
|
-
return join9(snapshotDir, `model-snapshot.${dialect}.json`);
|
|
18606
|
+
return join9(getSnapshotDir(workspaceRoot), `model-snapshot.${dialect}.json`);
|
|
18604
18607
|
}
|
|
18605
18608
|
function loadPlanSnapshot(workspaceRoot, dialect) {
|
|
18606
18609
|
const snapshotPath = getSnapshotPath(workspaceRoot, dialect);
|
|
@@ -18625,7 +18628,7 @@ function loadPlanSnapshot(workspaceRoot, dialect) {
|
|
|
18625
18628
|
}
|
|
18626
18629
|
function savePlanSnapshot(workspaceRoot, dialect, plan) {
|
|
18627
18630
|
const snapshotPath = getSnapshotPath(workspaceRoot, dialect);
|
|
18628
|
-
const snapshotDir =
|
|
18631
|
+
const snapshotDir = getSnapshotDir(workspaceRoot);
|
|
18629
18632
|
const hash = hashMigrationPlan(plan);
|
|
18630
18633
|
if (existsSync16(snapshotPath)) {
|
|
18631
18634
|
try {
|
|
@@ -18665,6 +18668,7 @@ function ensureSqlDirectory(workspaceRoot) {
|
|
|
18665
18668
|
return sqlDir;
|
|
18666
18669
|
}
|
|
18667
18670
|
async function generateMigration(dir, opts = {}) {
|
|
18671
|
+
await getConfig();
|
|
18668
18672
|
if (!dir) {
|
|
18669
18673
|
dir = join9(process25.cwd(), "app/Models");
|
|
18670
18674
|
}
|
|
@@ -18736,6 +18740,7 @@ async function generateMigration(dir, opts = {}) {
|
|
|
18736
18740
|
return { sql, sqlStatements, hasChanges, plan, operations };
|
|
18737
18741
|
}
|
|
18738
18742
|
async function executeMigration(dir) {
|
|
18743
|
+
await getConfig();
|
|
18739
18744
|
if (!dir) {
|
|
18740
18745
|
dir = join9(process25.cwd(), "app/Models");
|
|
18741
18746
|
}
|
|
@@ -18801,6 +18806,7 @@ async function executeMigration(dir) {
|
|
|
18801
18806
|
return true;
|
|
18802
18807
|
}
|
|
18803
18808
|
async function resetDatabase(dir, opts = {}) {
|
|
18809
|
+
await getConfig();
|
|
18804
18810
|
if (!dir) {
|
|
18805
18811
|
dir = join9(process25.cwd(), "app/Models");
|
|
18806
18812
|
}
|
|
@@ -31147,7 +31153,7 @@ function getPrefix() {
|
|
|
31147
31153
|
}
|
|
31148
31154
|
var prefix = getPrefix();
|
|
31149
31155
|
// package.json
|
|
31150
|
-
var version2 = "0.1.
|
|
31156
|
+
var version2 = "0.1.62";
|
|
31151
31157
|
|
|
31152
31158
|
// bin/cli.ts
|
|
31153
31159
|
init_actions();
|
package/dist/src/index.js
CHANGED
|
@@ -11703,6 +11703,7 @@ var init_config = __esm(() => {
|
|
|
11703
11703
|
init_dist();
|
|
11704
11704
|
defaultConfig4 = {
|
|
11705
11705
|
verbose: true,
|
|
11706
|
+
snapshotDir: ".qb",
|
|
11706
11707
|
dialect: "postgres",
|
|
11707
11708
|
database: {
|
|
11708
11709
|
database: "test_db",
|
|
@@ -18597,9 +18598,11 @@ function info(message) {
|
|
|
18597
18598
|
if (config5.verbose)
|
|
18598
18599
|
console.log(message);
|
|
18599
18600
|
}
|
|
18601
|
+
function getSnapshotDir(workspaceRoot) {
|
|
18602
|
+
return join9(workspaceRoot, config5.snapshotDir || ".qb");
|
|
18603
|
+
}
|
|
18600
18604
|
function getSnapshotPath(workspaceRoot, dialect) {
|
|
18601
|
-
|
|
18602
|
-
return join9(snapshotDir, `model-snapshot.${dialect}.json`);
|
|
18605
|
+
return join9(getSnapshotDir(workspaceRoot), `model-snapshot.${dialect}.json`);
|
|
18603
18606
|
}
|
|
18604
18607
|
function loadPlanSnapshot(workspaceRoot, dialect) {
|
|
18605
18608
|
const snapshotPath = getSnapshotPath(workspaceRoot, dialect);
|
|
@@ -18624,7 +18627,7 @@ function loadPlanSnapshot(workspaceRoot, dialect) {
|
|
|
18624
18627
|
}
|
|
18625
18628
|
function savePlanSnapshot(workspaceRoot, dialect, plan) {
|
|
18626
18629
|
const snapshotPath = getSnapshotPath(workspaceRoot, dialect);
|
|
18627
|
-
const snapshotDir =
|
|
18630
|
+
const snapshotDir = getSnapshotDir(workspaceRoot);
|
|
18628
18631
|
const hash = hashMigrationPlan(plan);
|
|
18629
18632
|
if (existsSync16(snapshotPath)) {
|
|
18630
18633
|
try {
|
|
@@ -18664,6 +18667,7 @@ function ensureSqlDirectory(workspaceRoot) {
|
|
|
18664
18667
|
return sqlDir;
|
|
18665
18668
|
}
|
|
18666
18669
|
async function generateMigration(dir, opts = {}) {
|
|
18670
|
+
await getConfig();
|
|
18667
18671
|
if (!dir) {
|
|
18668
18672
|
dir = join9(process25.cwd(), "app/Models");
|
|
18669
18673
|
}
|
|
@@ -18735,6 +18739,7 @@ async function generateMigration(dir, opts = {}) {
|
|
|
18735
18739
|
return { sql, sqlStatements, hasChanges, plan, operations };
|
|
18736
18740
|
}
|
|
18737
18741
|
async function executeMigration(dir) {
|
|
18742
|
+
await getConfig();
|
|
18738
18743
|
if (!dir) {
|
|
18739
18744
|
dir = join9(process25.cwd(), "app/Models");
|
|
18740
18745
|
}
|
|
@@ -18800,6 +18805,7 @@ async function executeMigration(dir) {
|
|
|
18800
18805
|
return true;
|
|
18801
18806
|
}
|
|
18802
18807
|
async function resetDatabase(dir, opts = {}) {
|
|
18808
|
+
await getConfig();
|
|
18803
18809
|
if (!dir) {
|
|
18804
18810
|
dir = join9(process25.cwd(), "app/Models");
|
|
18805
18811
|
}
|
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED