bun-query-builder 0.1.37 → 0.1.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/actions/introspect-db.d.ts +10 -0
- package/dist/bin/cli.js +610 -72
- package/dist/drivers/mysql.d.ts +7 -1
- package/dist/drivers/postgres.d.ts +7 -1
- package/dist/drivers/sqlite.d.ts +7 -1
- package/dist/migrations.d.ts +84 -10
- package/dist/src/index.js +612 -71
- package/dist/types.d.ts +4 -0
- package/package.json +1 -1
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { MigrationPlan, NormalizedColumnType } from '../migrations';
|
|
2
|
+
import type { SupportedDialect } from '../types';
|
|
1
3
|
/** Map a raw SQL column type to a model attribute type. */
|
|
2
4
|
export declare function sqlTypeToAttr(sqlType: string): AttrType;
|
|
3
5
|
/** PascalCase, singular model name for a table (`blog_posts` -> `BlogPost`). */
|
|
@@ -9,6 +11,14 @@ export declare function generateModelSource(table: string, columns: Introspected
|
|
|
9
11
|
* table. Pass `tables` to limit the set.
|
|
10
12
|
*/
|
|
11
13
|
export declare function introspectDatabase(opts?: { tables?: string[] }): Promise<IntrospectedModel[]>;
|
|
14
|
+
/** Map a raw SQL column type back to a normalized model column type. */
|
|
15
|
+
export declare function sqlTypeToNormalized(rawType: string, dialect: SupportedDialect, ctx?: { enumValues?: string[] }): NormalizedColumnType;
|
|
16
|
+
/**
|
|
17
|
+
* Read the live database into a full `MigrationPlan`. Tables are read in the
|
|
18
|
+
* dialect-native way (PRAGMA / information_schema / pg_catalog). The internal
|
|
19
|
+
* `migrations` bookkeeping table is excluded.
|
|
20
|
+
*/
|
|
21
|
+
export declare function buildPlanFromDatabase(dialect?: SupportedDialect, opts?: { tables?: string[] }): Promise<MigrationPlan>;
|
|
12
22
|
/**
|
|
13
23
|
* Reverse introspection (stacksjs/bun-query-builder#1047): read a LIVE database
|
|
14
24
|
* and emit `defineModel(...)` source, so an existing schema can be adopted
|