bun-query-builder 0.1.63 → 0.2.2

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.
@@ -13,6 +13,15 @@ export declare function generateModelSource(table: string, columns: Introspected
13
13
  export declare function introspectDatabase(opts?: { tables?: string[] }): Promise<IntrospectedModel[]>;
14
14
  /** Map a raw SQL column type back to a normalized model column type. */
15
15
  export declare function sqlTypeToNormalized(rawType: string, dialect: SupportedDialect, ctx?: { enumValues?: string[] }): NormalizedColumnType;
16
+ /**
17
+ * The plan type for one Postgres column, given what the catalogue knows.
18
+ *
19
+ * Separated from the query so the enum case can be tested without a live
20
+ * database: `USER-DEFINED` is the whole of what `information_schema` says about
21
+ * an enum column, and getting this wrong is invisible until a diff proposes a
22
+ * type change for a column nobody touched.
23
+ */
24
+ export declare function pgColumnType(dataType: string, udtName: string, enums: Map<string, string[]>): { type: NormalizedColumnType, enumValues?: string[], enumTypeName?: string };
16
25
  /**
17
26
  * Read the live database into a full `MigrationPlan`. Tables are read in the
18
27
  * dialect-native way (PRAGMA / information_schema / pg_catalog). The internal
@@ -1,7 +1,14 @@
1
1
  import type { SupportedDialect } from '../types';
2
2
  /**
3
- * Split a SQL script into individual statements, ignoring `;` inside single
4
- * quotes or `--` line comments. Good enough for our generated DDL.
3
+ * Split a SQL script into individual statements.
4
+ *
5
+ * Quoting is tracked for all three quote characters, and comments are removed
6
+ * as they are scanned rather than by dropping whole lines up front. The line
7
+ * filter missed a comment that trailed a statement — `ALTER TABLE …; -- note`
8
+ * left `-- note` behind as its own "statement", which the rollback then
9
+ * reported as un-reversible DDL — and only single quotes were tracked, so a
10
+ * `;` inside a double-quoted identifier or a backtick-quoted MySQL default
11
+ * split one statement into two broken halves.
5
12
  */
6
13
  export declare function splitSqlStatements(sql: string): string[];
7
14
  /**
@@ -25,4 +32,5 @@ export declare function migrateRollback(options?: RollbackOptions): Promise<void
25
32
  export declare interface RollbackOptions {
26
33
  steps?: number
27
34
  reverseSchema?: boolean
35
+ deleteFiles?: boolean
28
36
  }
@@ -8,6 +8,6 @@ export declare function migrateStatus(): Promise<MigrationStatus[]>;
8
8
  export declare function migrateList(): Promise<MigrationStatus[]>;
9
9
  export declare interface MigrationStatus {
10
10
  file: string
11
- status: 'executed' | 'pending' | 'transient'
11
+ status: 'executed' | 'pending'
12
12
  executedAt?: string
13
13
  }
@@ -24,6 +24,10 @@ export declare function saveMigrationSnapshot(plan: MigrationPlan, options?: { d
24
24
  * Simply update your models and run migrations - the system automatically figures out what changed.
25
25
  */
26
26
  export declare function generateMigration(dir?: string, opts?: MigrateOptions): Promise<GenerateMigrationResult>;
27
+ // `dir` is the models directory. This function runs the SQL corpus, which it
28
+ // finds from the workspace root, so it has no use for it — the parameter stays
29
+ // because it is public API and every caller passes it.
30
+ // eslint-disable-next-line pickier/no-unused-vars
27
31
  export declare function executeMigration(dir?: string): Promise<boolean>;
28
32
  export declare function resetDatabase(dir?: string, opts?: MigrateOptions): Promise<boolean>;
29
33
  export declare function deleteMigrationFiles(dir?: string, workspaceRoot?: string, opts?: MigrateOptions): Promise<void>;
@@ -1,4 +1,11 @@
1
- import type { RunSeederOptions, SeederConfig } from '@/seeder';
1
+ import type { RunSeederOptions, Seeder, SeederConfig } from '@/seeder';
2
+ /**
3
+ * Load all seeder files from a directory.
4
+ *
5
+ * Exported so a caller can inspect what would run — and so this is testable
6
+ * without a live database.
7
+ */
8
+ export declare function loadSeeders(seedersDir: string): Promise<Array<{ name: string, className: string, instance: Seeder }>>;
2
9
  /**
3
10
  * Run all seeders from a directory
4
11
  */