drizzle-kit 0.20.2 → 0.20.4-49fcbbb
Sign up to get free protection for your applications and to get access to all the features.
- package/bin.cjs +280 -155
- package/cli/commands/pgIntrospect.d.ts +6 -1
- package/cli/commands/sqliteIntrospect.d.ts +6 -1
- package/introspect-pg.d.ts +9 -0
- package/introspect-sqlite.d.ts +10 -0
- package/package.json +17 -4
- package/serializer/studioUtils.d.ts +15 -3
- package/utils-studio.d.mts +5 -0
- package/utils-studio.d.ts +1 -1
- package/utils-studio.js +13 -3
- package/utils-studio.mjs +3410 -0
- package/utils.js +22 -17
- package/introspect.d.ts +0 -4
- package/sqlite-introspect.d.ts +0 -5
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
|
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]
|
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
|
-
|
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
|
-
|
18010
|
-
|
18011
|
-
|
18012
|
-
|
18013
|
-
|
18014
|
-
|
18015
|
-
|
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, casing)).join(",\n")}
|
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
|
-
|
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
|
24699
|
-
var
|
24700
|
-
"src/sqlite
|
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
|
-
|
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
package/sqlite-introspect.d.ts
DELETED
@@ -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;
|