drizzle-kit 0.20.0-e4ed989 → 0.20.0-e84b695

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,10 +2,9 @@ import { entityKind } from "drizzle-orm";
2
2
  import type { Logger } from "drizzle-orm";
3
3
  import { type RelationalSchemaConfig, type TablesRelationalConfig } from "drizzle-orm";
4
4
  import { type Query } from "drizzle-orm";
5
- import type { SQLiteAsyncDialect, SQLiteExecuteMethod } from "drizzle-orm/sqlite-core";
5
+ import { SQLiteAsyncDialect, SQLiteExecuteMethod, SQLitePreparedQuery, SQLiteSession } from "drizzle-orm/sqlite-core";
6
6
  import type { SelectedFieldsOrdered } from "drizzle-orm/sqlite-core";
7
7
  import { type PreparedQueryConfig as PreparedQueryConfigBase, type SQLiteTransactionConfig } from "drizzle-orm/sqlite-core";
8
- import { PreparedQuery as PreparedQueryBase, SQLiteSession } from "drizzle-orm/sqlite-core";
9
8
  export interface SQLiteD1SessionOptions {
10
9
  logger?: Logger;
11
10
  }
@@ -25,7 +24,7 @@ export declare class SQLiteWranglerD1Session<TFullSchema extends Record<string,
25
24
  prepareQuery(query: Query, fields: SelectedFieldsOrdered | undefined, executeMethod: SQLiteExecuteMethod, customResultMapper?: (rows: unknown[][]) => unknown): PreparedQuery;
26
25
  transaction<T>(transaction: (tx: any) => T | Promise<T>, config?: SQLiteTransactionConfig): Promise<T>;
27
26
  }
28
- export declare class PreparedQuery<T extends PreparedQueryConfig = PreparedQueryConfig> extends PreparedQueryBase<{
27
+ export declare class PreparedQuery<T extends PreparedQueryConfig = PreparedQueryConfig> extends SQLitePreparedQuery<{
29
28
  type: "async";
30
29
  run: D1WranglerResults;
31
30
  all: T["all"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-kit",
3
- "version": "0.20.0-e4ed989",
3
+ "version": "0.20.0-e84b695",
4
4
  "repository": "https://github.com/drizzle-team/drizzle-kit-mirror",
5
5
  "author": "Drizzle Team",
6
6
  "license": "MIT",
@@ -40,7 +40,8 @@
40
40
  "packit": "pnpm build && cp package.json dist/ && cd dist && pnpm pack",
41
41
  "tsc": "tsc -p tsconfig.build.json",
42
42
  "pub": "cp package.json readme.md dist/ && cd dist && npm publish",
43
- "studio": "./dist/index.cjs studio --verbose"
43
+ "studio": "./dist/index.cjs studio --verbose",
44
+ "studio:dev": "tsx ./src/cli/index.ts studio --verbose"
44
45
  },
45
46
  "ava": {
46
47
  "files": [
@@ -54,7 +55,7 @@
54
55
  ]
55
56
  },
56
57
  "dependencies": {
57
- "@drizzle-team/studio": "^0.0.9",
58
+ "@drizzle-team/studio": "^0.0.26",
58
59
  "@esbuild-kit/esm-loader": "^2.5.5",
59
60
  "camelcase": "^7.0.1",
60
61
  "chalk": "^5.2.0",
@@ -76,20 +77,20 @@
76
77
  "@types/glob": "^8.1.0",
77
78
  "@types/minimatch": "^5.1.2",
78
79
  "@types/node": "^18.11.15",
79
- "@types/pg": "^8.6.5",
80
+ "@types/pg": "^8.10.7",
80
81
  "@typescript-eslint/eslint-plugin": "^5.46.1",
81
82
  "@typescript-eslint/parser": "^5.46.1",
82
83
  "ava": "^5.1.0",
83
84
  "better-sqlite3": "^8.4.0",
84
85
  "dockerode": "^3.3.4",
85
86
  "dotenv": "^16.0.3",
86
- "drizzle-orm": "0.28.7-4e094f0",
87
+ "drizzle-orm": "0.29.0-0a8127c",
87
88
  "eslint": "^8.29.0",
88
89
  "eslint-config-prettier": "^8.5.0",
89
90
  "eslint-plugin-prettier": "^4.2.1",
90
91
  "get-port": "^6.1.2",
91
92
  "mysql2": "2.3.3",
92
- "pg": "^8.8.0",
93
+ "pg": "^8.11.3",
93
94
  "postgres": "^3.3.5",
94
95
  "prettier": "^2.8.1",
95
96
  "tsx": "^3.12.1",
@@ -1,7 +1,7 @@
1
- import { PgSchemaInternal } from "./pgSchema";
2
- import { SQLiteSchemaInternal } from "./sqliteSchema";
3
- import { MySqlSchemaInternal } from "./mysqlSchema";
4
- import { SQL } from "drizzle-orm";
1
+ import type { PgSchemaInternal } from "./pgSchema";
2
+ import type { SQLiteSchemaInternal } from "./sqliteSchema";
3
+ import type { MySqlSchemaInternal } from "./mysqlSchema";
4
+ import type { SQL } from "drizzle-orm";
5
5
  export declare const sqlToStr: (sql: SQL) => string;
6
6
  export declare const serializeMySql: (path: string | string[]) => Promise<MySqlSchemaInternal>;
7
7
  export declare const serializePg: (path: string | string[], schemaFilter?: string[]) => Promise<PgSchemaInternal>;
@@ -1,9 +1,9 @@
1
1
  import { AnyPgTable, PgEnum, PgSchema } from "drizzle-orm/pg-core";
2
2
  import { Relations } from "drizzle-orm";
3
- import { IntrospectStage, IntrospectStatus } from "src/cli/views";
4
- import { PgSchemaInternal } from "src/serializer/pgSchema";
5
- import { DrizzleDbClient } from "src/drivers";
3
+ import type { IntrospectStage, IntrospectStatus } from "../cli/views";
4
+ import type { PgSchemaInternal } from "../serializer/pgSchema";
5
+ import type { DrizzleDbClient } from "../drivers";
6
6
  export declare const indexName: (tableName: string, columns: string[]) => string;
7
7
  export declare const generatePgSnapshot: (tables: AnyPgTable[], enums: PgEnum<any>[], schemas: PgSchema[], schemaFilter?: string[]) => PgSchemaInternal;
8
8
  export declare const fromDatabase: (db: DrizzleDbClient, tablesFilter: ((table: string) => boolean) | undefined, schemaFilters: string[], progressCallback?: ((stage: IntrospectStage, count: number, status: IntrospectStatus) => void) | undefined) => Promise<PgSchemaInternal>;
9
- export declare const toDrizzle: (schema: PgSchemaInternal) => Record<string, AnyPgTable | Relations>;
9
+ export declare const toDrizzle: (schema: PgSchemaInternal, schemaName: string) => Record<string, AnyPgTable | Relations>;
@@ -1,8 +1,8 @@
1
- import { SQLiteSchemaInternal } from "src/serializer/sqliteSchema";
1
+ import type { SQLiteSchemaInternal } from "../serializer/sqliteSchema";
2
2
  import { Relations } from "drizzle-orm";
3
3
  import { AnySQLiteTable } from "drizzle-orm/sqlite-core";
4
- import { IntrospectStage, IntrospectStatus } from "src/cli/views";
5
- import { DrizzleDbClient } from "src/drivers";
4
+ import type { IntrospectStage, IntrospectStatus } from "src/cli/views";
5
+ import type { DrizzleDbClient } from "src/drivers";
6
6
  export declare const generateSqliteSnapshot: (tables: AnySQLiteTable[], enums: any[]) => SQLiteSchemaInternal;
7
7
  export declare const fromDatabase: (db: DrizzleDbClient, tablesFilter?: (table: string) => boolean, progressCallback?: ((stage: IntrospectStage, count: number, status: IntrospectStatus) => void) | undefined) => Promise<SQLiteSchemaInternal>;
8
8
  export declare const toDrizzle: (schema: SQLiteSchemaInternal) => Record<string, AnySQLiteTable | Relations>;
@@ -1,13 +1,31 @@
1
+ import type { Setup } from "@drizzle-team/studio";
1
2
  import { Relations } from "drizzle-orm";
2
3
  import { AnyMySqlTable } from "drizzle-orm/mysql-core";
3
4
  import { AnyPgTable } from "drizzle-orm/pg-core";
4
5
  import { AnySQLiteTable } from "drizzle-orm/sqlite-core";
5
- import { StudioConfigConnections } from "src/cli/validations/studio";
6
+ import { MySQLConnectionConfig } from "src/cli/validations/mysql";
7
+ import { PgConnectionConfig } from "src/cli/validations/pg";
8
+ import { StudioConfigConnections, StudioSqliteConnectionConfig as StudioSQLiteConnectionConfig } from "src/cli/validations/studio";
9
+ export declare const preparePgSchema: (path: string | string[]) => Promise<{
10
+ schema: Record<string, Record<string, AnyPgTable<{}>>>;
11
+ relations: Record<string, Relations<string, Record<string, import("drizzle-orm").Relation<string>>>>;
12
+ }>;
13
+ export declare const prepareMySqlSchema: (path: string | string[]) => Promise<{
14
+ schema: Record<string, Record<string, AnyMySqlTable<{}>>>;
15
+ relations: Record<string, Relations<string, Record<string, import("drizzle-orm").Relation<string>>>>;
16
+ }>;
17
+ export declare const prepareSQLiteSchema: (path: string | string[]) => Promise<{
18
+ schema: Record<string, Record<string, AnySQLiteTable<{}>>>;
19
+ relations: Record<string, Relations<string, Record<string, import("drizzle-orm").Relation<string>>>>;
20
+ }>;
6
21
  export declare const prepareModels: (path: string | string[]) => Promise<{
7
22
  pgSchema: Record<string, AnyPgTable<{}> | Relations<string, Record<string, import("drizzle-orm").Relation<string>>>>;
8
23
  mysqlSchema: Record<string, AnyMySqlTable<{}> | Relations<string, Record<string, import("drizzle-orm").Relation<string>>>>;
9
24
  sqliteSchema: Record<string, Relations<string, Record<string, import("drizzle-orm").Relation<string>>> | AnySQLiteTable<{}>>;
10
25
  }>;
26
+ export declare const drizzleForPostgres: (connectionConfig: PgConnectionConfig, pgSchema: Record<string, Record<string, AnyPgTable>>, relations: Record<string, Relations>, verbose: boolean) => Promise<Setup>;
27
+ export declare const drizzleForMySQL: (config: MySQLConnectionConfig, mysqlSchema: Record<string, Record<string, AnyMySqlTable>>, relations: Record<string, Relations>, verbose: boolean) => Promise<Setup>;
28
+ export declare const drizzleForSQLite: (config: StudioSQLiteConnectionConfig, sqliteSchema: Record<string, Record<string, AnySQLiteTable>>, relations: Record<string, Relations>, verbose: boolean) => Promise<Setup>;
11
29
  export declare const drizzleDb: (drizzleConfig: StudioConfigConnections, models: {
12
30
  pgSchema?: Record<string, AnyPgTable | Relations>;
13
31
  mysqlSchema?: Record<string, AnyMySqlTable | Relations>;
@@ -1,5 +1,5 @@
1
1
  import "./@types/utils";
2
- import { ConfigIntrospectCasing } from "./cli/commands/utils";
3
- import { SQLiteSchema } from "./serializer/sqliteSchema";
2
+ import type { ConfigIntrospectCasing } from "./cli/commands/utils";
3
+ import type { SQLiteSchema } from "./serializer/sqliteSchema";
4
4
  export declare const indexName: (tableName: string, columns: string[]) => string;
5
5
  export declare const schemaToTypeScript: (schema: SQLiteSchema, casing: ConfigIntrospectCasing["casing"]) => string;
@@ -0,0 +1,5 @@
1
+ export { toDrizzle as drizzleSchemaPg } from "./serializer/pgSerializer";
2
+ export { toDrizzle as drizzleSchemaSQLite } from "./serializer/sqliteSerializer";
3
+ export { sqlitePushIntrospect } from "./cli/commands/sqliteIntrospect";
4
+ export { pgPushIntrospect } from "./cli/commands/pgIntrospect";
5
+ export { DrizzleORMPgClient } from "./drivers";