drizzle-kit 0.20.0-f28522c → 0.20.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/index.d.ts CHANGED
@@ -41,7 +41,7 @@ export type DbConnection = {
41
41
  password?: string;
42
42
  database: string;
43
43
  } | {
44
- connectionString: string;
44
+ uri: string;
45
45
  };
46
46
  };
47
47
  export type Config = {
@@ -93,12 +93,13 @@ export type Config = {
93
93
  password?: string;
94
94
  database: string;
95
95
  } | {
96
- connectionString: string;
96
+ uri: string;
97
97
  };
98
98
  } | {
99
99
  driver: "d1";
100
100
  dbCredentials: {
101
101
  wranglerConfigPath: string;
102
+ dbName: string;
102
103
  };
103
104
  } | {});
104
105
  export declare function defineConfig(config: Config): Config;
@@ -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-f28522c",
3
+ "version": "0.20.0",
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.27",
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-d3b1c58",
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>;
@@ -171,24 +171,24 @@ export declare const pgSchemaV1: import("zod").ZodObject<{
171
171
  }, "strict", import("zod").ZodTypeAny, {
172
172
  onUpdate?: string | undefined;
173
173
  onDelete?: string | undefined;
174
- column: string;
175
174
  foreignKeyName: string;
176
175
  table: string;
176
+ column: string;
177
177
  }, {
178
178
  onUpdate?: string | undefined;
179
179
  onDelete?: string | undefined;
180
- column: string;
181
180
  foreignKeyName: string;
182
181
  table: string;
182
+ column: string;
183
183
  }>>;
184
184
  }, "strict", import("zod").ZodTypeAny, {
185
185
  default?: any;
186
186
  references?: {
187
187
  onUpdate?: string | undefined;
188
188
  onDelete?: string | undefined;
189
- column: string;
190
189
  foreignKeyName: string;
191
190
  table: string;
191
+ column: string;
192
192
  } | undefined;
193
193
  name: string;
194
194
  type: string;
@@ -199,9 +199,9 @@ export declare const pgSchemaV1: import("zod").ZodObject<{
199
199
  references?: {
200
200
  onUpdate?: string | undefined;
201
201
  onDelete?: string | undefined;
202
- column: string;
203
202
  foreignKeyName: string;
204
203
  table: string;
204
+ column: string;
205
205
  } | undefined;
206
206
  name: string;
207
207
  type: string;
@@ -238,9 +238,9 @@ export declare const pgSchemaV1: import("zod").ZodObject<{
238
238
  references?: {
239
239
  onUpdate?: string | undefined;
240
240
  onDelete?: string | undefined;
241
- column: string;
242
241
  foreignKeyName: string;
243
242
  table: string;
243
+ column: string;
244
244
  } | undefined;
245
245
  name: string;
246
246
  type: string;
@@ -261,9 +261,9 @@ export declare const pgSchemaV1: import("zod").ZodObject<{
261
261
  references?: {
262
262
  onUpdate?: string | undefined;
263
263
  onDelete?: string | undefined;
264
- column: string;
265
264
  foreignKeyName: string;
266
265
  table: string;
266
+ column: string;
267
267
  } | undefined;
268
268
  name: string;
269
269
  type: string;
@@ -297,9 +297,9 @@ export declare const pgSchemaV1: import("zod").ZodObject<{
297
297
  references?: {
298
298
  onUpdate?: string | undefined;
299
299
  onDelete?: string | undefined;
300
- column: string;
301
300
  foreignKeyName: string;
302
301
  table: string;
302
+ column: string;
303
303
  } | undefined;
304
304
  name: string;
305
305
  type: string;
@@ -327,9 +327,9 @@ export declare const pgSchemaV1: import("zod").ZodObject<{
327
327
  references?: {
328
328
  onUpdate?: string | undefined;
329
329
  onDelete?: string | undefined;
330
- column: string;
331
330
  foreignKeyName: string;
332
331
  table: string;
332
+ column: string;
333
333
  } | undefined;
334
334
  name: string;
335
335
  type: string;
@@ -3059,24 +3059,24 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
3059
3059
  }, "strict", import("zod").ZodTypeAny, {
3060
3060
  onUpdate?: string | undefined;
3061
3061
  onDelete?: string | undefined;
3062
- column: string;
3063
3062
  foreignKeyName: string;
3064
3063
  table: string;
3064
+ column: string;
3065
3065
  }, {
3066
3066
  onUpdate?: string | undefined;
3067
3067
  onDelete?: string | undefined;
3068
- column: string;
3069
3068
  foreignKeyName: string;
3070
3069
  table: string;
3070
+ column: string;
3071
3071
  }>>;
3072
3072
  }, "strict", import("zod").ZodTypeAny, {
3073
3073
  default?: any;
3074
3074
  references?: {
3075
3075
  onUpdate?: string | undefined;
3076
3076
  onDelete?: string | undefined;
3077
- column: string;
3078
3077
  foreignKeyName: string;
3079
3078
  table: string;
3079
+ column: string;
3080
3080
  } | undefined;
3081
3081
  name: string;
3082
3082
  type: string;
@@ -3087,9 +3087,9 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
3087
3087
  references?: {
3088
3088
  onUpdate?: string | undefined;
3089
3089
  onDelete?: string | undefined;
3090
- column: string;
3091
3090
  foreignKeyName: string;
3092
3091
  table: string;
3092
+ column: string;
3093
3093
  } | undefined;
3094
3094
  name: string;
3095
3095
  type: string;
@@ -3126,9 +3126,9 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
3126
3126
  references?: {
3127
3127
  onUpdate?: string | undefined;
3128
3128
  onDelete?: string | undefined;
3129
- column: string;
3130
3129
  foreignKeyName: string;
3131
3130
  table: string;
3131
+ column: string;
3132
3132
  } | undefined;
3133
3133
  name: string;
3134
3134
  type: string;
@@ -3149,9 +3149,9 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
3149
3149
  references?: {
3150
3150
  onUpdate?: string | undefined;
3151
3151
  onDelete?: string | undefined;
3152
- column: string;
3153
3152
  foreignKeyName: string;
3154
3153
  table: string;
3154
+ column: string;
3155
3155
  } | undefined;
3156
3156
  name: string;
3157
3157
  type: string;
@@ -3185,9 +3185,9 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
3185
3185
  references?: {
3186
3186
  onUpdate?: string | undefined;
3187
3187
  onDelete?: string | undefined;
3188
- column: string;
3189
3188
  foreignKeyName: string;
3190
3189
  table: string;
3190
+ column: string;
3191
3191
  } | undefined;
3192
3192
  name: string;
3193
3193
  type: string;
@@ -3215,9 +3215,9 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
3215
3215
  references?: {
3216
3216
  onUpdate?: string | undefined;
3217
3217
  onDelete?: string | undefined;
3218
- column: string;
3219
3218
  foreignKeyName: string;
3220
3219
  table: string;
3220
+ column: string;
3221
3221
  } | undefined;
3222
3222
  name: string;
3223
3223
  type: string;
@@ -1,7 +1,9 @@
1
1
  import { AnyPgTable, PgEnum, PgSchema } from "drizzle-orm/pg-core";
2
- import { IntrospectStage, IntrospectStatus } from "src/cli/views";
3
- import { PgSchemaInternal } from "src/serializer/pgSchema";
4
- import { DrizzleDbClient } from "src/drivers";
2
+ import { Relations } from "drizzle-orm";
3
+ import type { IntrospectStage, IntrospectStatus } from "../cli/views";
4
+ import type { PgSchemaInternal } from "../serializer/pgSchema";
5
+ import type { DrizzleDbClient } from "../drivers";
5
6
  export declare const indexName: (tableName: string, columns: string[]) => string;
6
7
  export declare const generatePgSnapshot: (tables: AnyPgTable[], enums: PgEnum<any>[], schemas: PgSchema[], schemaFilter?: string[]) => PgSchemaInternal;
7
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, 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
- sqliteSchema: Record<string, AnySQLiteTable<{}> | Relations<string, Record<string, import("drizzle-orm").Relation<string>>>>;
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>;
@@ -23,13 +41,13 @@ export declare const drizzleDb: (drizzleConfig: StudioConfigConnections, models:
23
41
  } | {
24
42
  db: import("../orm-extenstions/d1-driver/driver").DrizzleD1WranglerDatabase<Record<string, never>>;
25
43
  type: "sqlite";
26
- schema: Record<string, AnySQLiteTable<{}> | Relations<string, Record<string, import("drizzle-orm").Relation<string>>>> | undefined;
44
+ schema: Record<string, Relations<string, Record<string, import("drizzle-orm").Relation<string>>> | AnySQLiteTable<{}>> | undefined;
27
45
  } | {
28
46
  db: import("drizzle-orm/better-sqlite3").BetterSQLite3Database<Record<string, never>>;
29
47
  type: "sqlite";
30
- schema: Record<string, AnySQLiteTable<{}> | Relations<string, Record<string, import("drizzle-orm").Relation<string>>>> | undefined;
48
+ schema: Record<string, Relations<string, Record<string, import("drizzle-orm").Relation<string>>> | AnySQLiteTable<{}>> | undefined;
31
49
  } | {
32
50
  db: import("drizzle-orm/libsql").LibSQLDatabase<Record<string, never>>;
33
51
  type: "sqlite";
34
- schema: Record<string, AnySQLiteTable<{}> | Relations<string, Record<string, import("drizzle-orm").Relation<string>>>> | undefined;
52
+ schema: Record<string, Relations<string, Record<string, import("drizzle-orm").Relation<string>>> | AnySQLiteTable<{}>> | undefined;
35
53
  }>;
@@ -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";