bun-query-builder 0.1.63 → 0.2.0
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/actions/migrate-rollback.d.ts +10 -2
- package/dist/actions/migrate-status.d.ts +1 -1
- package/dist/actions/migrate.d.ts +4 -0
- package/dist/actions/seed.d.ts +8 -1
- package/dist/bin/cli.js +405 -276
- package/dist/config.d.ts +13 -0
- package/dist/db.d.ts +12 -0
- package/dist/inflect.d.ts +17 -0
- package/dist/migrations.d.ts +26 -0
- package/dist/src/index.js +392 -260
- package/package.json +1 -1
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import type { SupportedDialect } from '../types';
|
|
2
2
|
/**
|
|
3
|
-
* Split a SQL script into individual statements
|
|
4
|
-
*
|
|
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'
|
|
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>;
|
package/dist/actions/seed.d.ts
CHANGED
|
@@ -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
|
*/
|