bun-query-builder 0.2.37 → 0.2.38

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 CHANGED
@@ -19567,21 +19567,25 @@ async function resetDatabase(dir, opts = {}) {
19567
19567
  } else {
19568
19568
  info("-- No enum types found to drop");
19569
19569
  }
19570
- if (tableNames.length > 0) {
19570
+ if (tableNames.length > 0 && !opts.preserveMigrationState) {
19571
19571
  try {
19572
19572
  await deleteMigrationFiles(dir, workspaceRoot, opts);
19573
19573
  } catch (err) {
19574
19574
  console.error(err);
19575
19575
  info("-- Could not clean up migration files");
19576
19576
  }
19577
- } else {
19577
+ } else if (tableNames.length === 0) {
19578
19578
  info("-- No models directory found; keeping committed migration files in place");
19579
+ } else {
19580
+ info("-- Preserving migration files and model snapshot for fresh replay");
19579
19581
  }
19580
- try {
19581
- await clearGeneratedDirectory(workspaceRoot);
19582
- } catch (err) {
19583
- console.error(err);
19584
- info("-- Could not clear generated directory");
19582
+ if (!opts.preserveMigrationState) {
19583
+ try {
19584
+ await clearGeneratedDirectory(workspaceRoot);
19585
+ } catch (err) {
19586
+ console.error(err);
19587
+ info("-- Could not clear generated directory");
19588
+ }
19585
19589
  }
19586
19590
  info("-- Database reset completed successfully");
19587
19591
  return true;
@@ -32329,7 +32333,7 @@ function getPrefix() {
32329
32333
  }
32330
32334
  var prefix = getPrefix();
32331
32335
  // package.json
32332
- var version2 = "0.2.37";
32336
+ var version2 = "0.2.38";
32333
32337
 
32334
32338
  // bin/cli.ts
32335
32339
  init_actions();
package/dist/src/index.js CHANGED
@@ -19566,21 +19566,25 @@ async function resetDatabase(dir, opts = {}) {
19566
19566
  } else {
19567
19567
  info("-- No enum types found to drop");
19568
19568
  }
19569
- if (tableNames.length > 0) {
19569
+ if (tableNames.length > 0 && !opts.preserveMigrationState) {
19570
19570
  try {
19571
19571
  await deleteMigrationFiles(dir, workspaceRoot, opts);
19572
19572
  } catch (err) {
19573
19573
  console.error(err);
19574
19574
  info("-- Could not clean up migration files");
19575
19575
  }
19576
- } else {
19576
+ } else if (tableNames.length === 0) {
19577
19577
  info("-- No models directory found; keeping committed migration files in place");
19578
+ } else {
19579
+ info("-- Preserving migration files and model snapshot for fresh replay");
19578
19580
  }
19579
- try {
19580
- await clearGeneratedDirectory(workspaceRoot);
19581
- } catch (err) {
19582
- console.error(err);
19583
- info("-- Could not clear generated directory");
19581
+ if (!opts.preserveMigrationState) {
19582
+ try {
19583
+ await clearGeneratedDirectory(workspaceRoot);
19584
+ } catch (err) {
19585
+ console.error(err);
19586
+ info("-- Could not clear generated directory");
19587
+ }
19584
19588
  }
19585
19589
  info("-- Database reset completed successfully");
19586
19590
  return true;
package/dist/types.d.ts CHANGED
@@ -271,6 +271,7 @@ export declare interface IntrospectOptions {
271
271
  }
272
272
  export declare interface MigrateOptions {
273
273
  dialect?: SupportedDialect
274
+ preserveMigrationState?: boolean
274
275
  vitessSharded?: boolean
275
276
  state?: string
276
277
  apply?: boolean
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bun-query-builder",
3
3
  "type": "module",
4
- "version": "0.2.37",
4
+ "version": "0.2.38",
5
5
  "description": "A simple yet performant query builder for TypeScript. Built with Bun.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",