drizzle-kit 0.20.14-f5f86f6 → 0.20.14

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.
Files changed (40) hide show
  1. package/bin.cjs +39950 -39765
  2. package/cli/commands/migrate.d.ts +7 -7
  3. package/cli/commands/mysqlUp.d.ts +1 -1
  4. package/cli/commands/pgConnect.d.ts +1 -1
  5. package/cli/commands/pgIntrospect.d.ts +1 -1
  6. package/cli/commands/pgPushUtils.d.ts +2 -2
  7. package/cli/commands/pgUp.d.ts +1 -1
  8. package/cli/commands/upFolders.d.ts +1 -1
  9. package/cli/commands/utils.d.ts +2 -11
  10. package/cli/validations/common.d.ts +1 -1
  11. package/cli/validations/studio.d.ts +16 -16
  12. package/cli/views.d.ts +1 -1
  13. package/drivers/index.d.ts +0 -14
  14. package/global.d.ts +0 -1
  15. package/package.json +3 -15
  16. package/schemaValidator.d.ts +1 -1
  17. package/serializer/mysqlImports.d.ts +0 -5
  18. package/serializer/mysqlSerializer.d.ts +4 -4
  19. package/serializer/sqliteImports.d.ts +0 -4
  20. package/serializer/sqliteSerializer.d.ts +2 -2
  21. package/serializer/studioUtils.d.ts +7 -7
  22. package/utils-studio.js +7 -12
  23. package/utils-studio.mjs +7 -12
  24. package/utils.d.ts +15 -1
  25. package/utils.js +54799 -3578
  26. package/cli/commands/check.d.ts +0 -2
  27. package/cli/commands/drop.d.ts +0 -4
  28. package/cli/commands/mysqlIntrospect.d.ts +0 -119
  29. package/cli/commands/mysqlPushUtils.d.ts +0 -18
  30. package/cli/commands/push.d.ts +0 -6
  31. package/cli/commands/sqlitePushUtils.d.ts +0 -21
  32. package/cli/commands/sqliteUp.d.ts +0 -2
  33. package/cli/index.d.ts +0 -71
  34. package/introspect-mysql.d.ts +0 -9
  35. package/payload.d.mts +0 -33
  36. package/payload.d.ts +0 -33
  37. package/payload.js +0 -37000
  38. package/payload.mjs +0 -37019
  39. package/utils/certs.d.ts +0 -4
  40. package/utils.mjs +0 -8076
@@ -1,9 +1,9 @@
1
1
  import { CommonSchema, CommonSquashedSchema, Dialect } from "../../schemaValidator";
2
2
  import { schema } from "../views";
3
- import { PgSchema } from "../../serializer/pgSchema";
4
- import { SQLiteSchema } from "../../serializer/sqliteSchema";
5
- import { MySqlSchema } from "../../serializer/mysqlSchema";
6
- import { Journal } from "../../utils";
3
+ import { PgSchema } from "src/serializer/pgSchema";
4
+ import { SQLiteSchema } from "src/serializer/sqliteSchema";
5
+ import { MySqlSchema } from "src/serializer/mysqlSchema";
6
+ import { Journal } from "src/utils";
7
7
  import { GenerateConfig } from "./utils";
8
8
  export type Named = {
9
9
  name: string;
@@ -132,7 +132,7 @@ export declare const prepareMySQLPush: (config: {
132
132
  schemas: Record<string, string>;
133
133
  };
134
134
  };
135
- }>;
135
+ } | undefined>;
136
136
  export declare const prepareSQLitePush: (config: {
137
137
  schema: string | string[];
138
138
  }, snapshot: SQLiteSchema) => Promise<{
@@ -183,7 +183,7 @@ export declare const prepareSQLitePush: (config: {
183
183
  tables: {};
184
184
  columns: {};
185
185
  } | undefined;
186
- }>;
186
+ } | undefined>;
187
187
  export declare const preparePgPush: (config: {
188
188
  schema: string | string[];
189
189
  }, snapshot: PgSchema, schemaFilter: string[]) => Promise<{
@@ -243,7 +243,7 @@ export declare const preparePgPush: (config: {
243
243
  values: Record<string, string>;
244
244
  }>;
245
245
  };
246
- }>;
246
+ } | undefined>;
247
247
  export declare const prepareAndMigrateMySql: (config: GenerateConfig) => Promise<void>;
248
248
  export declare const prepareAndMigrateSqlite: (config: GenerateConfig) => Promise<void>;
249
249
  export declare const prepareSQL: (prev: CommonSquashedSchema, cur: CommonSquashedSchema, dialect: Dialect, prevFull?: any, curFull?: any) => Promise<{
@@ -1,4 +1,4 @@
1
- import { MySqlSchema, MySqlSchemaV4 } from "../../serializer/mysqlSchema";
1
+ import { MySqlSchema, MySqlSchemaV4 } from "src/serializer/mysqlSchema";
2
2
  export declare const upMysqlHandler: (out: string) => void;
3
3
  export declare const upMySqlHandlerV4toV5: (obj: MySqlSchemaV4) => MySqlSchema;
4
4
  export declare const upMysqlHandlerV4: (out: string) => void;
@@ -1,5 +1,5 @@
1
1
  import type { PgConnectionConfig } from "../validations/pg";
2
- import { PgPostgres } from "../../drivers";
2
+ import { PgPostgres } from "src/drivers";
3
3
  export declare const connectToPg: (config: PgConnectionConfig) => Promise<{
4
4
  client: PgPostgres;
5
5
  }>;
@@ -1,5 +1,5 @@
1
1
  import type { PgConfigIntrospect } from "../validations/pg";
2
- import type { DrizzleDbClient } from "../../drivers";
2
+ import type { DrizzleDbClient } from "src/drivers";
3
3
  export declare const pgSchemas: (client: DrizzleDbClient) => Promise<string[]>;
4
4
  export declare const pgPushIntrospect: (connection: {
5
5
  client: DrizzleDbClient;
@@ -1,5 +1,5 @@
1
- import { DrizzleDbClient } from "../../drivers";
2
- import { JsonStatement } from "../../jsonStatements";
1
+ import { DrizzleDbClient } from "src/drivers";
2
+ import { JsonStatement } from "src/jsonStatements";
3
3
  export declare const pgSuggestions: ({ connection, statements, }: {
4
4
  statements: JsonStatement[];
5
5
  connection: DrizzleDbClient;
@@ -1,4 +1,4 @@
1
- import { PgSchema, PgSchemaV4 } from "../../serializer/pgSchema";
1
+ import { PgSchema, PgSchemaV4 } from "src/serializer/pgSchema";
2
2
  export declare const upPgHandlerV4toV5: (obj: PgSchemaV4) => PgSchema;
3
3
  export declare const upPgHandler: (out: string) => void;
4
4
  export declare const upPgHandlerV4: (out: string) => void;
@@ -1,4 +1,4 @@
1
- import { Dialect } from "../../schemaValidator";
1
+ import { Dialect } from "src/schemaValidator";
2
2
  import { Named, NamedWithSchema } from "./migrate";
3
3
  export declare const resolveSchemas: <T extends Named>(missingSchemas: T[], newSchemas: T[], predicate: (leftMissing: T[], created: T) => T | undefined) => {
4
4
  created: T[];
@@ -1,8 +1,4 @@
1
1
  import { TypeOf } from "zod";
2
- import { CliParamsPush } from "..";
3
- import { MySQLPushConfig } from "../validations/mysql";
4
- import { PgPushConfig } from "../validations/pg";
5
- import { SQLitePushConfig } from "../validations/sqlite";
6
2
  export declare const safeRegister: () => Promise<{
7
3
  unregister: () => void;
8
4
  }>;
@@ -20,11 +16,6 @@ export declare const prepareGenerateConfig: (options: {
20
16
  breakpoints: boolean;
21
17
  custom: boolean;
22
18
  }) => Promise<GenerateConfig>;
23
- export declare const preparePushConfig: (options: CliParamsPush) => Promise<{
24
- config: MySQLPushConfig | PgPushConfig | SQLitePushConfig;
25
- schemaFiles: string[];
26
- tablesFilter: string[];
27
- }>;
28
19
  export declare const assertOutFolder: (it: {
29
20
  config?: string;
30
21
  } | {
@@ -47,8 +38,8 @@ export declare const configCommonSchema: import("zod").ZodObject<{
47
38
  schemaFilter: string | string[];
48
39
  }, {
49
40
  out?: string | undefined;
50
- driver?: "turso" | "better-sqlite" | "libsql" | "d1" | "pg" | "mysql2" | "expo" | undefined;
51
41
  breakpoints?: boolean | undefined;
42
+ driver?: "turso" | "better-sqlite" | "libsql" | "d1" | "pg" | "mysql2" | "expo" | undefined;
52
43
  tablesFilter?: string | string[] | undefined;
53
44
  schemaFilter?: string | string[] | undefined;
54
45
  schema: string | string[];
@@ -190,8 +181,8 @@ export declare const mySqlCliConfigSchema: import("zod").ZodIntersection<import(
190
181
  schemaFilter: string | string[];
191
182
  }, {
192
183
  out?: string | undefined;
193
- driver?: "turso" | "better-sqlite" | "libsql" | "d1" | "pg" | "mysql2" | "expo" | undefined;
194
184
  breakpoints?: boolean | undefined;
185
+ driver?: "turso" | "better-sqlite" | "libsql" | "d1" | "pg" | "mysql2" | "expo" | undefined;
195
186
  tablesFilter?: string | string[] | undefined;
196
187
  schemaFilter?: string | string[] | undefined;
197
188
  schema: string | string[];
@@ -3,7 +3,7 @@ export type CollusionCheckOutput = {
3
3
  message?: string;
4
4
  action: "config" | "cli" | "error";
5
5
  };
6
- export type Commands = "push:sqlite" | "introspect:sqlite" | "introspect:pg" | "generate" | "check:pg" | "check:mysql" | "check:sqlite" | "up:pg" | "up:mysql" | "up:sqlite" | "drop" | "introspect:mysql" | "push:mysql" | "push:pg";
6
+ export type Commands = "push:sqlite" | "introspect:sqlite" | "introspect:pg" | "generate:pg" | "generate:sqlite" | "generate:mysql" | "check:pg" | "check:mysql" | "check:sqlite" | "up:pg" | "up:mysql" | "up:sqlite" | "drop" | "introspect:mysql" | "push:mysql" | "push:pg";
7
7
  /**
8
8
  * This function checks an input from a user and if there are any params together with config path - return true
9
9
  * @param options - user input
@@ -541,22 +541,6 @@ export type StudioSqliteConnectionConfig = TypeOf<typeof stuioSqliteConnectionCo
541
541
  export declare const validateStudio: (options: any) => Promise<{
542
542
  schema: string | string[];
543
543
  } & ({
544
- driver: "turso";
545
- dbCredentials: {
546
- authToken?: string | undefined;
547
- url: string;
548
- };
549
- } | {
550
- driver: "libsql";
551
- dbCredentials: {
552
- url: string;
553
- };
554
- } | {
555
- driver: "better-sqlite";
556
- dbCredentials: {
557
- url: string;
558
- };
559
- } | {
560
544
  driver: "pg";
561
545
  dbCredentials: {
562
546
  type?: "params" | undefined;
@@ -573,6 +557,22 @@ export declare const validateStudio: (options: any) => Promise<{
573
557
  type?: "url" | undefined;
574
558
  connectionString: string;
575
559
  };
560
+ } | {
561
+ driver: "turso";
562
+ dbCredentials: {
563
+ authToken?: string | undefined;
564
+ url: string;
565
+ };
566
+ } | {
567
+ driver: "libsql";
568
+ dbCredentials: {
569
+ url: string;
570
+ };
571
+ } | {
572
+ driver: "better-sqlite";
573
+ dbCredentials: {
574
+ url: string;
575
+ };
576
576
  } | {
577
577
  driver: "mysql2";
578
578
  dbCredentials: {
package/cli/views.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Prompt, TaskView } from "hanji";
2
- import type { CommonSchema } from "../schemaValidator";
2
+ import type { CommonSchema } from "src/schemaValidator";
3
3
  import type { Named } from "./commands/migrate";
4
4
  export declare const warning: (msg: string) => void;
5
5
  export declare const err: (msg: string) => void;
@@ -1,6 +1,4 @@
1
1
  import type { Client } from "@libsql/client";
2
- import { BetterSQLite3Database } from "drizzle-orm/better-sqlite3";
3
- import { MySql2Database } from "drizzle-orm/mysql2";
4
2
  import type { PgDatabase } from "drizzle-orm/pg-core";
5
3
  import type { Client as PgClient } from "pg";
6
4
  export declare abstract class DrizzleDbClient<T = any> {
@@ -13,22 +11,10 @@ export declare class DrizzleORMPgClient extends DrizzleDbClient<PgDatabase<any>>
13
11
  query<K = any>(query: string, values?: any[] | undefined): Promise<K[]>;
14
12
  run(query: string): Promise<void>;
15
13
  }
16
- export declare class DrizzleORMMySQLClient extends DrizzleDbClient<MySql2Database<any>> {
17
- query<K = any>(query: string, values?: any[] | undefined): Promise<K[]>;
18
- run(query: string): Promise<void>;
19
- }
20
- export declare class DrizzleORMSQLiteClient extends DrizzleDbClient<BetterSQLite3Database<any>> {
21
- query<K = any>(query: string, values?: any[] | undefined): Promise<K[]>;
22
- run(query: string): Promise<void>;
23
- }
24
14
  export declare class BetterSqlite extends DrizzleDbClient {
25
15
  run(query: string): Promise<void>;
26
16
  query(query: string): Promise<any[]>;
27
17
  }
28
- export declare class MySQL2Client extends DrizzleDbClient {
29
- run(query: string): Promise<void>;
30
- query(query: string): Promise<any>;
31
- }
32
18
  export declare class TursoSqlite extends DrizzleDbClient<Client> {
33
19
  run(query: string): Promise<void>;
34
20
  query(query: string): Promise<any[]>;
package/global.d.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  export declare const originUUID = "00000000-0000-0000-0000-000000000000";
2
2
  export declare const snapshotVersion = "5";
3
3
  export declare function assertUnreachable(x: never): never;
4
- export declare const mapValues: <IN, OUT>(obj: Record<string, IN>, map: (input: IN) => OUT) => Record<string, OUT>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-kit",
3
- "version": "0.20.14-f5f86f6",
3
+ "version": "0.20.14",
4
4
  "repository": "https://github.com/drizzle-team/drizzle-kit-mirror",
5
5
  "author": "Drizzle Team",
6
6
  "license": "MIT",
@@ -36,7 +36,7 @@
36
36
  "sim:sqlite": "node -r esbuild-register ./dev/sqlite/index.ts",
37
37
  "test": "ava test --timeout=60s",
38
38
  "build": "rm -rf ./dist && tsc -p tsconfig.cli-types.json && pnpm mts && tsx build.ts",
39
- "mts": "cp dist/index.d.ts dist/index.d.mts && cp dist/utils-studio.d.ts dist/utils-studio.d.mts && cp dist/payload.d.ts dist/payload.d.mts",
39
+ "mts": "cp dist/index.d.ts dist/index.d.mts && cp dist/utils-studio.d.ts dist/utils-studio.d.mts",
40
40
  "build:dev": "rm -rf ./dist && tsx build.dev.ts && tsc -p tsconfig.cli-types.json && chmod +x ./dist/index.cjs",
41
41
  "packit": "pnpm build && cp package.json dist/ && cd dist && pnpm pack",
42
42
  "tsc": "tsc -p tsconfig.build.json",
@@ -73,7 +73,7 @@
73
73
  },
74
74
  "devDependencies": {
75
75
  "@cloudflare/workers-types": "^4.20230518.0",
76
- "@libsql/client": "^0.4.2",
76
+ "@libsql/client": "^0.1.6",
77
77
  "@types/better-sqlite3": "^7.6.4",
78
78
  "@types/dockerode": "^3.3.14",
79
79
  "@types/glob": "^8.1.0",
@@ -128,18 +128,6 @@
128
128
  },
129
129
  "types": "./utils-studio.d.mts",
130
130
  "default": "./utils-studio.mjs"
131
- },
132
- "./payload": {
133
- "import": {
134
- "types": "./payload.d.mts",
135
- "default": "./payload.mjs"
136
- },
137
- "require": {
138
- "types": "./payload.d.ts",
139
- "default": "./payload.js"
140
- },
141
- "types": "./payload.d.mts",
142
- "default": "./payload.mjs"
143
131
  }
144
132
  }
145
133
  }
@@ -1,5 +1,5 @@
1
1
  import { TypeOf } from "zod";
2
- export declare const dialect: import("zod").ZodEnum<["pg", "mysql", "sqlite"]>;
2
+ declare const dialect: import("zod").ZodEnum<["pg", "mysql", "sqlite"]>;
3
3
  export type Dialect = TypeOf<typeof dialect>;
4
4
  declare const commonSquashedSchema: import("zod").ZodUnion<[import("zod").ZodObject<{
5
5
  version: import("zod").ZodLiteral<"5">;
@@ -1,9 +1,4 @@
1
1
  import { AnyMySqlTable, MySqlSchema } from "drizzle-orm/mysql-core";
2
- export declare const prepareFromExports: (exports: Record<string, unknown>) => {
3
- tables: AnyMySqlTable<{}>[];
4
- enums: any[];
5
- schemas: MySqlSchema<string>[];
6
- };
7
2
  export declare const prepareFromMySqlImports: (imports: string[]) => Promise<{
8
3
  tables: AnyMySqlTable<{}>[];
9
4
  enums: any[];
@@ -1,7 +1,7 @@
1
1
  import { AnyMySqlTable, MySqlSchema } from "drizzle-orm/mysql-core";
2
- import { MySqlSchemaInternal } from "../serializer/mysqlSchema";
3
- import { IntrospectStage, IntrospectStatus } from "../cli/views";
4
- import { DrizzleDbClient } from "src/drivers";
2
+ import { MySqlSchemaInternal } from "src/serializer/mysqlSchema";
3
+ import { Connection } from "mysql2/promise";
4
+ import { IntrospectStage, IntrospectStatus } from "src/cli/views";
5
5
  export declare const indexName: (tableName: string, columns: string[]) => string;
6
6
  export declare const generateMySqlSnapshot: (tables: AnyMySqlTable[], enums: any[], mysqlSchemas: MySqlSchema[]) => MySqlSchemaInternal;
7
- export declare const fromDatabase: (db: DrizzleDbClient, inputSchema: string, tablesFilter?: (table: string) => boolean, progressCallback?: ((stage: IntrospectStage, count: number, status: IntrospectStatus) => void) | undefined) => Promise<MySqlSchemaInternal>;
7
+ export declare const fromDatabase: (db: Connection, inputSchema: string, tablesFilter?: (table: string) => boolean, progressCallback?: ((stage: IntrospectStage, count: number, status: IntrospectStatus) => void) | undefined) => Promise<MySqlSchemaInternal>;
@@ -1,8 +1,4 @@
1
1
  import { AnySQLiteTable } from "drizzle-orm/sqlite-core";
2
- export declare const prepareFromExports: (exports: Record<string, unknown>) => {
3
- tables: AnySQLiteTable<{}>[];
4
- enums: any[];
5
- };
6
2
  export declare const prepareFromSqliteImports: (imports: string[]) => Promise<{
7
3
  tables: AnySQLiteTable<{}>[];
8
4
  enums: any[];
@@ -1,6 +1,6 @@
1
1
  import type { SQLiteSchemaInternal } from "../serializer/sqliteSchema";
2
2
  import { AnySQLiteTable } from "drizzle-orm/sqlite-core";
3
- import type { IntrospectStage, IntrospectStatus } from "../cli/views";
4
- import type { DrizzleDbClient } from "../drivers";
3
+ import type { IntrospectStage, IntrospectStatus } from "src/cli/views";
4
+ import type { DrizzleDbClient } from "src/drivers";
5
5
  export declare const generateSqliteSnapshot: (tables: AnySQLiteTable[], enums: any[]) => SQLiteSchemaInternal;
6
6
  export declare const fromDatabase: (db: DrizzleDbClient, tablesFilter?: (table: string) => boolean, progressCallback?: ((stage: IntrospectStage, count: number, status: IntrospectStatus) => void) | undefined) => Promise<SQLiteSchemaInternal>;
@@ -3,9 +3,9 @@ import { Relations } from "drizzle-orm";
3
3
  import { AnyMySqlTable } from "drizzle-orm/mysql-core";
4
4
  import { AnyPgTable } from "drizzle-orm/pg-core";
5
5
  import { AnySQLiteTable } from "drizzle-orm/sqlite-core";
6
- import { MySQLConnectionConfig } from "../cli/validations/mysql";
7
- import { PgConnectionConfig } from "../cli/validations/pg";
8
- import { StudioConfigConnections, StudioSqliteConnectionConfig as StudioSQLiteConnectionConfig } from "../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
9
  export declare const preparePgSchema: (path: string | string[]) => Promise<{
10
10
  schema: Record<string, Record<string, AnyPgTable<{}>>>;
11
11
  relations: Record<string, Relations<string, Record<string, import("drizzle-orm").Relation<string>>>>;
@@ -21,7 +21,7 @@ export declare const prepareSQLiteSchema: (path: string | string[]) => Promise<{
21
21
  export declare const prepareModels: (path: string | string[]) => Promise<{
22
22
  pgSchema: Record<string, AnyPgTable<{}> | Relations<string, Record<string, import("drizzle-orm").Relation<string>>>>;
23
23
  mysqlSchema: Record<string, AnyMySqlTable<{}> | Relations<string, Record<string, import("drizzle-orm").Relation<string>>>>;
24
- sqliteSchema: Record<string, Relations<string, Record<string, import("drizzle-orm").Relation<string>>> | AnySQLiteTable<{}>>;
24
+ sqliteSchema: Record<string, AnySQLiteTable<{}> | Relations<string, Record<string, import("drizzle-orm").Relation<string>>>>;
25
25
  }>;
26
26
  export declare const drizzleForPostgres: (connectionConfig: PgConnectionConfig, pgSchema: Record<string, Record<string, AnyPgTable>>, relations: Record<string, Relations>, ts: {
27
27
  imports: string;
@@ -53,13 +53,13 @@ export declare const drizzleDb: (drizzleConfig: StudioConfigConnections, models:
53
53
  } | {
54
54
  db: import("../orm-extenstions/d1-driver/driver").DrizzleD1WranglerDatabase<Record<string, never>>;
55
55
  type: "sqlite";
56
- schema: Record<string, Relations<string, Record<string, import("drizzle-orm").Relation<string>>> | AnySQLiteTable<{}>> | undefined;
56
+ schema: Record<string, AnySQLiteTable<{}> | Relations<string, Record<string, import("drizzle-orm").Relation<string>>>> | undefined;
57
57
  } | {
58
58
  db: import("drizzle-orm/better-sqlite3").BetterSQLite3Database<Record<string, never>>;
59
59
  type: "sqlite";
60
- schema: Record<string, Relations<string, Record<string, import("drizzle-orm").Relation<string>>> | AnySQLiteTable<{}>> | undefined;
60
+ schema: Record<string, AnySQLiteTable<{}> | Relations<string, Record<string, import("drizzle-orm").Relation<string>>>> | undefined;
61
61
  } | {
62
62
  db: import("drizzle-orm/libsql").LibSQLDatabase<Record<string, never>>;
63
63
  type: "sqlite";
64
- schema: Record<string, Relations<string, Record<string, import("drizzle-orm").Relation<string>>> | AnySQLiteTable<{}>> | undefined;
64
+ schema: Record<string, AnySQLiteTable<{}> | Relations<string, Record<string, import("drizzle-orm").Relation<string>>>> | undefined;
65
65
  }>;
package/utils-studio.js CHANGED
@@ -1081,14 +1081,6 @@ var init_views = __esm({
1081
1081
  }
1082
1082
  });
1083
1083
 
1084
- // src/global.ts
1085
- var originUUID;
1086
- var init_global = __esm({
1087
- "src/global.ts"() {
1088
- originUUID = "00000000-0000-0000-0000-000000000000";
1089
- }
1090
- });
1091
-
1092
1084
  // src/serializer/index.ts
1093
1085
  var glob;
1094
1086
  var init_serializer = __esm({
@@ -1579,7 +1571,7 @@ var init_pgSerializer = __esm({
1579
1571
  --end;
1580
1572
  return start > 0 || end < str.length ? str.substring(start, end) : str.toString();
1581
1573
  };
1582
- fromDatabase2 = async (db, tablesFilter = () => true, schemaFilters, progressCallback) => {
1574
+ fromDatabase2 = async (db, tablesFilter = (table) => true, schemaFilters, progressCallback) => {
1583
1575
  const result = {};
1584
1576
  const internals = { tables: {} };
1585
1577
  const where = schemaFilters.map((t) => `table_schema = '${t}'`).join(" or ");
@@ -1639,7 +1631,7 @@ var init_pgSerializer = __esm({
1639
1631
  END AS data_type, INFORMATION_SCHEMA.COLUMNS.table_name, INFORMATION_SCHEMA.COLUMNS.column_name, INFORMATION_SCHEMA.COLUMNS.column_default, INFORMATION_SCHEMA.COLUMNS.data_type as additional_dt
1640
1632
  FROM pg_attribute a
1641
1633
  JOIN INFORMATION_SCHEMA.COLUMNS ON INFORMATION_SCHEMA.COLUMNS.column_name = a.attname
1642
- WHERE a.attrelid = '"${tableSchema}"."${tableName}"'::regclass and INFORMATION_SCHEMA.COLUMNS.table_name = '${tableName}' and INFORMATION_SCHEMA.COLUMNS.table_schema = '${tableSchema}'
1634
+ WHERE a.attrelid = '"${tableSchema}"."${tableName}"'::regclass and INFORMATION_SCHEMA.COLUMNS.table_name = '${tableName}'
1643
1635
  AND a.attnum > 0
1644
1636
  AND NOT a.attisdropped
1645
1637
  ORDER BY a.attnum;`
@@ -2174,7 +2166,11 @@ var sqliteSchemaToDrizzle = (schema) => {
2174
2166
 
2175
2167
  // src/cli/commands/sqliteIntrospect.ts
2176
2168
  init_views();
2177
- init_global();
2169
+
2170
+ // src/global.ts
2171
+ var originUUID = "00000000-0000-0000-0000-000000000000";
2172
+
2173
+ // src/cli/commands/sqliteIntrospect.ts
2178
2174
  init_sqliteSerializer();
2179
2175
 
2180
2176
  // node_modules/.pnpm/camelcase@7.0.1/node_modules/camelcase/index.js
@@ -3360,7 +3356,6 @@ var import_relations = require("drizzle-orm/relations");
3360
3356
  init_pgSerializer();
3361
3357
 
3362
3358
  // src/cli/commands/pgIntrospect.ts
3363
- init_global();
3364
3359
  var pgPushIntrospect = async (connection, filters, schemaFilters) => {
3365
3360
  const { client } = connection;
3366
3361
  const matchers = filters.map((it) => {
package/utils-studio.mjs CHANGED
@@ -1083,14 +1083,6 @@ var init_views = __esm({
1083
1083
  }
1084
1084
  });
1085
1085
 
1086
- // src/global.ts
1087
- var originUUID;
1088
- var init_global = __esm({
1089
- "src/global.ts"() {
1090
- originUUID = "00000000-0000-0000-0000-000000000000";
1091
- }
1092
- });
1093
-
1094
1086
  // src/serializer/index.ts
1095
1087
  import * as glob from "glob";
1096
1088
  var init_serializer = __esm({
@@ -1588,7 +1580,7 @@ var init_pgSerializer = __esm({
1588
1580
  --end;
1589
1581
  return start > 0 || end < str.length ? str.substring(start, end) : str.toString();
1590
1582
  };
1591
- fromDatabase2 = async (db, tablesFilter = () => true, schemaFilters, progressCallback) => {
1583
+ fromDatabase2 = async (db, tablesFilter = (table) => true, schemaFilters, progressCallback) => {
1592
1584
  const result = {};
1593
1585
  const internals = { tables: {} };
1594
1586
  const where = schemaFilters.map((t) => `table_schema = '${t}'`).join(" or ");
@@ -1648,7 +1640,7 @@ var init_pgSerializer = __esm({
1648
1640
  END AS data_type, INFORMATION_SCHEMA.COLUMNS.table_name, INFORMATION_SCHEMA.COLUMNS.column_name, INFORMATION_SCHEMA.COLUMNS.column_default, INFORMATION_SCHEMA.COLUMNS.data_type as additional_dt
1649
1641
  FROM pg_attribute a
1650
1642
  JOIN INFORMATION_SCHEMA.COLUMNS ON INFORMATION_SCHEMA.COLUMNS.column_name = a.attname
1651
- WHERE a.attrelid = '"${tableSchema}"."${tableName}"'::regclass and INFORMATION_SCHEMA.COLUMNS.table_name = '${tableName}' and INFORMATION_SCHEMA.COLUMNS.table_schema = '${tableSchema}'
1643
+ WHERE a.attrelid = '"${tableSchema}"."${tableName}"'::regclass and INFORMATION_SCHEMA.COLUMNS.table_name = '${tableName}'
1652
1644
  AND a.attnum > 0
1653
1645
  AND NOT a.attisdropped
1654
1646
  ORDER BY a.attnum;`
@@ -2208,7 +2200,11 @@ var sqliteSchemaToDrizzle = (schema) => {
2208
2200
 
2209
2201
  // src/cli/commands/sqliteIntrospect.ts
2210
2202
  init_views();
2211
- init_global();
2203
+
2204
+ // src/global.ts
2205
+ var originUUID = "00000000-0000-0000-0000-000000000000";
2206
+
2207
+ // src/cli/commands/sqliteIntrospect.ts
2212
2208
  init_sqliteSerializer();
2213
2209
 
2214
2210
  // node_modules/.pnpm/camelcase@7.0.1/node_modules/camelcase/index.js
@@ -3399,7 +3395,6 @@ import {
3399
3395
  init_pgSerializer();
3400
3396
 
3401
3397
  // src/cli/commands/pgIntrospect.ts
3402
- init_global();
3403
3398
  var pgPushIntrospect = async (connection, filters, schemaFilters) => {
3404
3399
  const { client } = connection;
3405
3400
  const matchers = filters.map((it) => {
package/utils.d.ts CHANGED
@@ -1,5 +1,8 @@
1
- import type { Dialect } from "./schemaValidator";
1
+ import { Dialect } from "./schemaValidator";
2
2
  import { NamedWithSchema } from "./cli/commands/migrate";
3
+ import { PgDatabase } from "drizzle-orm/pg-core";
4
+ import { PgSchema as PgSchemaKit } from "./serializer/pgSchema";
5
+ import { DbConnection } from ".";
3
6
  export declare const assertV1OutFolder: (out: string, dialect: Dialect | "{dialect}") => void;
4
7
  export type Journal = {
5
8
  version: string;
@@ -19,6 +22,7 @@ export declare const prepareOutFolder: (out: string, dialect: Dialect) => {
19
22
  snapshots: string[];
20
23
  journal: any;
21
24
  };
25
+ export declare const mapValues: <IN, OUT>(obj: Record<string, IN>, map: (input: IN) => OUT) => Record<string, OUT>;
22
26
  export declare const validateWithReport: (snapshots: string[], dialect: Dialect) => {
23
27
  malformed: string[];
24
28
  nonLatest: string[];
@@ -197,3 +201,13 @@ export declare const statementsForDiffs: (in1: any, in2: any) => Promise<{
197
201
  columns: {};
198
202
  } | undefined;
199
203
  }>;
204
+ export type DrizzleSnapshotJSON = PgSchemaKit;
205
+ export declare const generateDrizzleJson: (imports: Record<string, unknown>, prevId?: string) => PgSchemaKit;
206
+ export declare const generateMigration: (prev: DrizzleSnapshotJSON, cur: DrizzleSnapshotJSON) => Promise<string[]>;
207
+ export declare const pushSchema: (imports: Record<string, unknown>, db: PgDatabase<any>) => Promise<{
208
+ hasDataLoss: boolean;
209
+ warnings: string[];
210
+ statementsToExecute: string[];
211
+ apply: () => Promise<void>;
212
+ }>;
213
+ export declare const prepareFrom: (connection: DbConnection) => Promise<Record<string, any>>;