drizzle-kit 0.24.1 → 0.24.2-1321cf9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (8) hide show
  1. package/api.js +1250 -665
  2. package/api.mjs +1250 -665
  3. package/bin.cjs +50406 -47005
  4. package/index.d.mts +12 -7
  5. package/index.d.ts +12 -7
  6. package/package.json +2 -2
  7. package/utils.js +19 -0
  8. package/utils.mjs +17 -0
package/index.d.mts CHANGED
@@ -2,10 +2,10 @@ import { ConnectionOptions } from 'tls';
2
2
 
3
3
  declare const prefixes: readonly ["index", "timestamp", "supabase", "unix", "none"];
4
4
  type Prefix = (typeof prefixes)[number];
5
- declare const drivers: readonly ["turso", "d1-http", "expo", "aws-data-api"];
5
+ declare const drivers: readonly ["d1-http", "expo", "aws-data-api", "pglite"];
6
6
  type Driver = (typeof drivers)[number];
7
7
 
8
- declare const dialects: readonly ["postgresql", "mysql", "sqlite"];
8
+ declare const dialects: readonly ["postgresql", "mysql", "sqlite", "turso"];
9
9
  type Dialect = (typeof dialects)[number];
10
10
 
11
11
  type SslOptions = {
@@ -43,7 +43,7 @@ type Verify<T, U extends T> = U;
43
43
  *
44
44
  * ---
45
45
  * `driver` - optional param that is responsible for explicitly providing a driver to use when accessing a database
46
- * *Possible values*: `aws-data-api`, `d1-http`, `expo`, `turso`
46
+ * *Possible values*: `aws-data-api`, `d1-http`, `expo`, `turso`, `pglite`
47
47
  * If you don't use AWS Data API, D1, Turso or Expo - ypu don't need this driver. You can check a driver strategy choice here: https://orm.drizzle.team/kit-docs/upgrade-21
48
48
  *
49
49
  * See https://orm.drizzle.team/kit-docs/config-reference#driver
@@ -128,14 +128,13 @@ type Config = {
128
128
  casing: 'camel' | 'preserve';
129
129
  };
130
130
  } & ({
131
- dialect: Verify<Dialect, 'sqlite'>;
132
- driver: Verify<Driver, 'turso'>;
131
+ dialect: Verify<Dialect, 'turso'>;
133
132
  dbCredentials: {
134
133
  url: string;
135
134
  authToken?: string;
136
135
  };
137
136
  } | {
138
- dialect: 'sqlite';
137
+ dialect: Verify<Dialect, 'sqlite'>;
139
138
  dbCredentials: {
140
139
  url: string;
141
140
  };
@@ -159,6 +158,12 @@ type Config = {
159
158
  secretArn: string;
160
159
  resourceArn: string;
161
160
  };
161
+ } | {
162
+ dialect: Verify<Dialect, 'postgresql'>;
163
+ driver: Verify<Driver, 'pglite'>;
164
+ dbCredentials: {
165
+ url: string;
166
+ };
162
167
  } | {
163
168
  dialect: Verify<Dialect, 'mysql'>;
164
169
  dbCredentials: {
@@ -207,7 +212,7 @@ type Config = {
207
212
  *
208
213
  * ---
209
214
  * `driver` - optional param that is responsible for explicitly providing a driver to use when accessing a database
210
- * *Possible values*: `aws-data-api`, `d1-http`, `expo`, `turso`
215
+ * *Possible values*: `aws-data-api`, `d1-http`, `expo`, `turso`, `pglite`
211
216
  * If you don't use AWS Data API, D1, Turso or Expo - ypu don't need this driver. You can check a driver strategy choice here: https://orm.drizzle.team/kit-docs/upgrade-21
212
217
  *
213
218
  * See https://orm.drizzle.team/kit-docs/config-reference#driver
package/index.d.ts CHANGED
@@ -2,10 +2,10 @@ import { ConnectionOptions } from 'tls';
2
2
 
3
3
  declare const prefixes: readonly ["index", "timestamp", "supabase", "unix", "none"];
4
4
  type Prefix = (typeof prefixes)[number];
5
- declare const drivers: readonly ["turso", "d1-http", "expo", "aws-data-api"];
5
+ declare const drivers: readonly ["d1-http", "expo", "aws-data-api", "pglite"];
6
6
  type Driver = (typeof drivers)[number];
7
7
 
8
- declare const dialects: readonly ["postgresql", "mysql", "sqlite"];
8
+ declare const dialects: readonly ["postgresql", "mysql", "sqlite", "turso"];
9
9
  type Dialect = (typeof dialects)[number];
10
10
 
11
11
  type SslOptions = {
@@ -43,7 +43,7 @@ type Verify<T, U extends T> = U;
43
43
  *
44
44
  * ---
45
45
  * `driver` - optional param that is responsible for explicitly providing a driver to use when accessing a database
46
- * *Possible values*: `aws-data-api`, `d1-http`, `expo`, `turso`
46
+ * *Possible values*: `aws-data-api`, `d1-http`, `expo`, `turso`, `pglite`
47
47
  * If you don't use AWS Data API, D1, Turso or Expo - ypu don't need this driver. You can check a driver strategy choice here: https://orm.drizzle.team/kit-docs/upgrade-21
48
48
  *
49
49
  * See https://orm.drizzle.team/kit-docs/config-reference#driver
@@ -128,14 +128,13 @@ type Config = {
128
128
  casing: 'camel' | 'preserve';
129
129
  };
130
130
  } & ({
131
- dialect: Verify<Dialect, 'sqlite'>;
132
- driver: Verify<Driver, 'turso'>;
131
+ dialect: Verify<Dialect, 'turso'>;
133
132
  dbCredentials: {
134
133
  url: string;
135
134
  authToken?: string;
136
135
  };
137
136
  } | {
138
- dialect: 'sqlite';
137
+ dialect: Verify<Dialect, 'sqlite'>;
139
138
  dbCredentials: {
140
139
  url: string;
141
140
  };
@@ -159,6 +158,12 @@ type Config = {
159
158
  secretArn: string;
160
159
  resourceArn: string;
161
160
  };
161
+ } | {
162
+ dialect: Verify<Dialect, 'postgresql'>;
163
+ driver: Verify<Driver, 'pglite'>;
164
+ dbCredentials: {
165
+ url: string;
166
+ };
162
167
  } | {
163
168
  dialect: Verify<Dialect, 'mysql'>;
164
169
  dbCredentials: {
@@ -207,7 +212,7 @@ type Config = {
207
212
  *
208
213
  * ---
209
214
  * `driver` - optional param that is responsible for explicitly providing a driver to use when accessing a database
210
- * *Possible values*: `aws-data-api`, `d1-http`, `expo`, `turso`
215
+ * *Possible values*: `aws-data-api`, `d1-http`, `expo`, `turso`, `pglite`
211
216
  * If you don't use AWS Data API, D1, Turso or Expo - ypu don't need this driver. You can check a driver strategy choice here: https://orm.drizzle.team/kit-docs/upgrade-21
212
217
  *
213
218
  * See https://orm.drizzle.team/kit-docs/config-reference#driver
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-kit",
3
- "version": "0.24.1",
3
+ "version": "0.24.2-1321cf9",
4
4
  "homepage": "https://orm.drizzle.team",
5
5
  "keywords": [
6
6
  "drizzle",
@@ -54,7 +54,7 @@
54
54
  "@electric-sql/pglite": "^0.1.5",
55
55
  "@hono/node-server": "^1.9.0",
56
56
  "@hono/zod-validator": "^0.2.1",
57
- "@libsql/client": "^0.4.2",
57
+ "@libsql/client": "^0.10.0",
58
58
  "@neondatabase/serverless": "^0.9.1",
59
59
  "@originjs/vite-plugin-commonjs": "^1.0.3",
60
60
  "@planetscale/database": "^1.16.0",
package/utils.js CHANGED
@@ -568,8 +568,10 @@ __export(utils_exports, {
568
568
  columnRenameKey: () => columnRenameKey,
569
569
  copy: () => copy,
570
570
  dryJournal: () => dryJournal,
571
+ findAddedAndRemoved: () => findAddedAndRemoved,
571
572
  isPgArrayType: () => isPgArrayType,
572
573
  kloudMeta: () => kloudMeta,
574
+ normalisePGliteUrl: () => normalisePGliteUrl,
573
575
  normaliseSQLiteUrl: () => normaliseSQLiteUrl,
574
576
  objectValues: () => objectValues,
575
577
  prepareMigrationFolder: () => prepareMigrationFolder,
@@ -5595,6 +5597,8 @@ var validatorForDialect = (dialect3) => {
5595
5597
  return { validator: backwardCompatiblePgSchema, version: 7 };
5596
5598
  case "sqlite":
5597
5599
  return { validator: backwardCompatibleSqliteSchema, version: 6 };
5600
+ case "turso":
5601
+ return { validator: backwardCompatibleSqliteSchema, version: 6 };
5598
5602
  case "mysql":
5599
5603
  return { validator: backwardCompatibleMysqlSchema, version: 5 };
5600
5604
  }
@@ -5740,17 +5744,32 @@ var normaliseSQLiteUrl = (it, type) => {
5740
5744
  }
5741
5745
  assertUnreachable(type);
5742
5746
  };
5747
+ var normalisePGliteUrl = (it) => {
5748
+ if (it.startsWith("file:")) {
5749
+ return it.substring(5);
5750
+ }
5751
+ return it;
5752
+ };
5743
5753
  function isPgArrayType(sqlType) {
5744
5754
  return sqlType.match(/.*\[\d*\].*|.*\[\].*/g) !== null;
5745
5755
  }
5756
+ function findAddedAndRemoved(columnNames1, columnNames2) {
5757
+ const set1 = new Set(columnNames1);
5758
+ const set2 = new Set(columnNames2);
5759
+ const addedColumns = columnNames2.filter((it) => !set1.has(it));
5760
+ const removedColumns = columnNames1.filter((it) => !set2.has(it));
5761
+ return { addedColumns, removedColumns };
5762
+ }
5746
5763
  // Annotate the CommonJS export names for ESM import in node:
5747
5764
  0 && (module.exports = {
5748
5765
  assertV1OutFolder,
5749
5766
  columnRenameKey,
5750
5767
  copy,
5751
5768
  dryJournal,
5769
+ findAddedAndRemoved,
5752
5770
  isPgArrayType,
5753
5771
  kloudMeta,
5772
+ normalisePGliteUrl,
5754
5773
  normaliseSQLiteUrl,
5755
5774
  objectValues,
5756
5775
  prepareMigrationFolder,
package/utils.mjs CHANGED
@@ -5576,6 +5576,8 @@ var validatorForDialect = (dialect3) => {
5576
5576
  return { validator: backwardCompatiblePgSchema, version: 7 };
5577
5577
  case "sqlite":
5578
5578
  return { validator: backwardCompatibleSqliteSchema, version: 6 };
5579
+ case "turso":
5580
+ return { validator: backwardCompatibleSqliteSchema, version: 6 };
5579
5581
  case "mysql":
5580
5582
  return { validator: backwardCompatibleMysqlSchema, version: 5 };
5581
5583
  }
@@ -5721,16 +5723,31 @@ var normaliseSQLiteUrl = (it, type) => {
5721
5723
  }
5722
5724
  assertUnreachable(type);
5723
5725
  };
5726
+ var normalisePGliteUrl = (it) => {
5727
+ if (it.startsWith("file:")) {
5728
+ return it.substring(5);
5729
+ }
5730
+ return it;
5731
+ };
5724
5732
  function isPgArrayType(sqlType) {
5725
5733
  return sqlType.match(/.*\[\d*\].*|.*\[\].*/g) !== null;
5726
5734
  }
5735
+ function findAddedAndRemoved(columnNames1, columnNames2) {
5736
+ const set1 = new Set(columnNames1);
5737
+ const set2 = new Set(columnNames2);
5738
+ const addedColumns = columnNames2.filter((it) => !set1.has(it));
5739
+ const removedColumns = columnNames1.filter((it) => !set2.has(it));
5740
+ return { addedColumns, removedColumns };
5741
+ }
5727
5742
  export {
5728
5743
  assertV1OutFolder,
5729
5744
  columnRenameKey,
5730
5745
  copy,
5731
5746
  dryJournal,
5747
+ findAddedAndRemoved,
5732
5748
  isPgArrayType,
5733
5749
  kloudMeta,
5750
+ normalisePGliteUrl,
5734
5751
  normaliseSQLiteUrl,
5735
5752
  objectValues,
5736
5753
  prepareMigrationFolder,