drizzle-kit 0.20.2 → 0.20.4-d303ac3

Sign up to get free protection for your applications and to get access to all the features.
package/utils.js CHANGED
@@ -17771,10 +17771,10 @@ var init_utils2 = __esm({
17771
17771
  }
17772
17772
  });
17773
17773
 
17774
- // src/introspect.ts
17774
+ // src/introspect-pg.ts
17775
17775
  var pgImportsList, objToStatement2, timeConfig, possibleIntervals, intervalStrToObj, intervalConfig, importsPatch, relations, withCasing, schemaToTypeScript, isCyclic, isSelf, column4, dimensionsInArray, createTableColumns, createTableIndexes, createTablePKs, createTableUniques, createTableFKs;
17776
- var init_introspect = __esm({
17777
- "src/introspect.ts"() {
17776
+ var init_introspect_pg = __esm({
17777
+ "src/introspect-pg.ts"() {
17778
17778
  init_utils2();
17779
17779
  init_pgSerializer();
17780
17780
  pgImportsList = /* @__PURE__ */ new Set([
@@ -17932,7 +17932,7 @@ var init_introspect = __esm({
17932
17932
  res.pg.push("pgEnum");
17933
17933
  }
17934
17934
  const columnImports = Object.values(it.columns).map((col) => {
17935
- let patched = importsPatch[col.type] ?? col.type;
17935
+ let patched = importsPatch[col.type] || col.type;
17936
17936
  patched = patched.startsWith("varchar(") ? "varchar" : patched;
17937
17937
  patched = patched.startsWith("char(") ? "char" : patched;
17938
17938
  patched = patched.startsWith("numeric(") ? "numeric" : patched;
@@ -18001,18 +18001,23 @@ var init_introspect = __esm({
18001
18001
  return statement;
18002
18002
  });
18003
18003
  const uniquePgImports = ["pgTable", ...new Set(imports.pg)];
18004
- let result = `import { ${uniquePgImports.join(
18004
+ const importsTs = `import { ${uniquePgImports.join(
18005
18005
  ", "
18006
18006
  )} } from "drizzle-orm/pg-core"
18007
+ import { sql } from "drizzle-orm"
18007
18008
 
18008
18009
  `;
18009
- result += `import { sql } from "drizzle-orm"
18010
- `;
18011
- result += enumStatements;
18012
- result += schemaStatements;
18013
- result += "\n";
18014
- result += tableStatements.join("\n\n");
18015
- return result;
18010
+ let decalrations = enumStatements;
18011
+ decalrations += schemaStatements;
18012
+ decalrations += "\n";
18013
+ decalrations += tableStatements.join("\n\n");
18014
+ const file = importsTs + decalrations;
18015
+ const schemaEntry = `
18016
+ {
18017
+ ${Object.values(schema4.tables).map((it) => withCasing(it.name)).join(",")}
18018
+ }
18019
+ `;
18020
+ return { file, imports: importsTs, decalrations, schemaEntry };
18016
18021
  };
18017
18022
  isCyclic = (fk4) => {
18018
18023
  const key = `${fk4.tableFrom}-${fk4.tableTo}`;
@@ -24368,7 +24373,7 @@ var init_pgIntrospect = __esm({
24368
24373
  import_hanji4 = __toESM(require_hanji());
24369
24374
  init_views();
24370
24375
  init_pgSerializer();
24371
- init_introspect();
24376
+ init_introspect_pg();
24372
24377
  init_global();
24373
24378
  init_mjs();
24374
24379
  pgSchemas = async (client) => {
@@ -24695,9 +24700,9 @@ var init_pgPushUtils = __esm({
24695
24700
  }
24696
24701
  });
24697
24702
 
24698
- // src/sqlite-introspect.ts
24699
- var init_sqlite_introspect = __esm({
24700
- "src/sqlite-introspect.ts"() {
24703
+ // src/introspect-sqlite.ts
24704
+ var init_introspect_sqlite = __esm({
24705
+ "src/introspect-sqlite.ts"() {
24701
24706
  init_utils2();
24702
24707
  }
24703
24708
  });
@@ -24709,7 +24714,7 @@ var init_sqliteIntrospect = __esm({
24709
24714
  init_views();
24710
24715
  init_global();
24711
24716
  init_sqliteSerializer();
24712
- init_sqlite_introspect();
24717
+ init_introspect_sqlite();
24713
24718
  init_mjs();
24714
24719
  import_hanji7 = __toESM(require_hanji());
24715
24720
  connectToSQLite = async (config) => {
package/introspect.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import "./@types/utils";
2
- import { ConfigIntrospectCasing } from "./cli/commands/utils";
3
- import { PgSchema } from "./serializer/pgSchema";
4
- export declare const schemaToTypeScript: (schema: PgSchema, casing: ConfigIntrospectCasing) => string;
@@ -1,5 +0,0 @@
1
- import "./@types/utils";
2
- import type { ConfigIntrospectCasing } from "./cli/commands/utils";
3
- import type { SQLiteSchema } from "./serializer/sqliteSchema";
4
- export declare const indexName: (tableName: string, columns: string[]) => string;
5
- export declare const schemaToTypeScript: (schema: SQLiteSchema, casing: ConfigIntrospectCasing["casing"]) => string;