drizzle-kit 0.19.0-c1c76b7 → 0.19.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.
Files changed (4) hide show
  1. package/index.cjs +892 -306
  2. package/index.d.ts +35 -1
  3. package/package.json +3 -2
  4. package/utils.js +9 -5
package/index.d.ts CHANGED
@@ -5,6 +5,10 @@ export type Config = {
5
5
  schema?: string | string[];
6
6
  verbose?: boolean | undefined;
7
7
  strict?: boolean | undefined;
8
+ } & {
9
+ introspect?: {
10
+ casing: "camel" | "preserve";
11
+ };
8
12
  } & ({
9
13
  port?: number | undefined;
10
14
  password?: string | undefined;
@@ -20,7 +24,7 @@ export type Config = {
20
24
  authToken?: string;
21
25
  };
22
26
  } | {
23
- driver: "sqlite";
27
+ driver: "better-sqlite";
24
28
  dbCredentials: {
25
29
  url: string;
26
30
  };
@@ -29,4 +33,34 @@ export type Config = {
29
33
  dbCredentials: {
30
34
  url: string;
31
35
  };
36
+ } | {
37
+ driver: "pg";
38
+ dbCredentials: {
39
+ host: string;
40
+ port?: number;
41
+ user?: string;
42
+ password?: string;
43
+ database: string;
44
+ ssl?: boolean;
45
+ };
46
+ } | {
47
+ driver: "pg";
48
+ dbCredentials: {
49
+ connectionString: string;
50
+ };
51
+ } | {
52
+ driver: "mysql2";
53
+ dbCredentials: {
54
+ host: string;
55
+ port?: number;
56
+ user?: string;
57
+ password?: string;
58
+ database: string;
59
+ connectionString: string;
60
+ };
61
+ } | {
62
+ driver: "mysql2";
63
+ dbCredentials: {
64
+ connectionString: string;
65
+ };
32
66
  } | {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-kit",
3
- "version": "0.19.0-c1c76b7",
3
+ "version": "0.19.0",
4
4
  "repository": "https://github.com/drizzle-team/drizzle-kit-mirror",
5
5
  "author": "Drizzle Team",
6
6
  "license": "MIT",
@@ -34,6 +34,7 @@
34
34
  "sim:sqlite": "node -r esbuild-register ./dev/sqlite/index.ts",
35
35
  "test": "ava test --timeout=60s",
36
36
  "build": "rm -rf ./dist && tsx build.ts && tsc -p tsconfig.cli-types.json",
37
+ "build:dev": "rm -rf ./dist && tsx build.dev.ts && tsc -p tsconfig.cli-types.json && chmod +x ./dist/index.cjs",
37
38
  "pack": "build && package",
38
39
  "tsc": "tsc -p tsconfig.build.json",
39
40
  "pub": "cp package.json readme.md dist/ && cd dist && npm publish"
@@ -74,7 +75,7 @@
74
75
  "better-sqlite3": "^8.4.0",
75
76
  "dockerode": "^3.3.4",
76
77
  "dotenv": "^16.0.3",
77
- "drizzle-orm": "0.26.5-8235b73",
78
+ "drizzle-orm": "0.27.0-56b9edc",
78
79
  "esbuild": "^0.17.19",
79
80
  "esbuild-register": "^3.4.2",
80
81
  "eslint": "^8.29.0",
package/utils.js CHANGED
@@ -13602,7 +13602,7 @@ var PgCreateTableConvertor = class extends Convertor {
13602
13602
  const primaryKeyStatement = column4.primaryKey ? "PRIMARY KEY" : "";
13603
13603
  const notNullStatement = column4.notNull ? "NOT NULL" : "";
13604
13604
  const defaultStatement = column4.default !== void 0 ? `DEFAULT ${column4.default}` : "";
13605
- const type = isPgNativeType(column4.type) ? column4.type : `${column4.type}`;
13605
+ const type = isPgNativeType(column4.type) ? column4.type : `"${column4.type}"`;
13606
13606
  statement += " " + `"${column4.name}" ${type} ${primaryKeyStatement} ${defaultStatement} ${notNullStatement}`.replace(/ +/g, " ").trim();
13607
13607
  statement += (i === columns.length - 1 ? "" : ",") + "\n";
13608
13608
  }
@@ -13766,9 +13766,9 @@ var PgRenameTableConvertor = class extends Convertor {
13766
13766
  return statement.type === "rename_table" && dialect3 === "pg";
13767
13767
  }
13768
13768
  convert(statement) {
13769
- const { tableNameFrom, tableNameTo, toSchema: schema4 } = statement;
13770
- const from = schema4 ? `"${schema4}"."${tableNameFrom}"` : `"${tableNameFrom}"`;
13771
- const to = schema4 ? `"${schema4}"."${tableNameTo}"` : `"${tableNameTo}"`;
13769
+ const { tableNameFrom, tableNameTo, toSchema, fromSchema } = statement;
13770
+ const from = fromSchema ? `"${fromSchema}"."${tableNameFrom}"` : `"${tableNameFrom}"`;
13771
+ const to = `"${tableNameTo}"`;
13772
13772
  return `ALTER TABLE ${from} RENAME TO ${to};`;
13773
13773
  }
13774
13774
  };
@@ -15678,7 +15678,11 @@ var applySnapshotsDiff = async (json1, json2, dialect3, schemasResolver, tablesR
15678
15678
  }).flat();
15679
15679
  const jsonReferencesForAllAlteredTables = allAltered.map((it) => {
15680
15680
  const schema4 = valueFromSelfOrPatchedNew(it.schema);
15681
- const forAdded = dialect3 !== "sqlite" ? prepareCreateReferencesJson(it.name, schema4, it.addedForeignKeys) : [];
15681
+ const forAdded = prepareCreateReferencesJson(
15682
+ it.name,
15683
+ schema4,
15684
+ it.addedForeignKeys
15685
+ );
15682
15686
  const forAltered = prepareDropReferencesJson(
15683
15687
  it.name,
15684
15688
  schema4,