drizzle-kit 0.22.0-72736ba → 0.22.0-a8a3158

Sign up to get free protection for your applications and to get access to all the features.
package/utils-studio.js CHANGED
@@ -4848,7 +4848,7 @@ var init_lib = __esm({
4848
4848
  });
4849
4849
 
4850
4850
  // src/serializer/mysqlSchema.ts
4851
- var index, fk, column, tableV3, compositePK, uniqueConstraint, tableV4, table, kitInternals, dialect, schemaHash, schemaInternalV3, schemaInternalV4, schemaInternalV5, schemaInternal, schemaV3, schemaV4, schemaV5, schema, tableSquashedV4, tableSquashed, schemaSquashed, schemaSquashedV4, mysqlSchema, mysqlSchemaV5, backwardCompatibleMysqlSchema, dryMySql;
4851
+ var index, fk, column, tableV3, compositePK, uniqueConstraint, tableV4, table, kitInternals, dialect, schemaHash, schemaInternalV3, schemaInternalV4, schemaInternalV5, schemaInternal, schemaV3, schemaV4, schemaV5, schema, tableSquashedV4, tableSquashed, schemaSquashed, schemaSquashedV4, mysqlSchema, mysqlSchemaV5, mysqlSchemaSquashed, backwardCompatibleMysqlSchema, dryMySql;
4852
4852
  var init_mysqlSchema = __esm({
4853
4853
  "src/serializer/mysqlSchema.ts"() {
4854
4854
  "use strict";
@@ -4990,6 +4990,7 @@ var init_mysqlSchema = __esm({
4990
4990
  }).strict();
4991
4991
  mysqlSchema = schema;
4992
4992
  mysqlSchemaV5 = schemaV5;
4993
+ mysqlSchemaSquashed = schemaSquashed;
4993
4994
  backwardCompatibleMysqlSchema = unionType([mysqlSchemaV5, schema]);
4994
4995
  dryMySql = mysqlSchema.parse({
4995
4996
  version: "5",
@@ -5337,7 +5338,7 @@ var init_pgSchema = __esm({
5337
5338
  });
5338
5339
 
5339
5340
  // src/serializer/sqliteSchema.ts
5340
- var index3, fk3, compositePK3, column3, tableV33, uniqueConstraint3, table3, dialect2, schemaHash3, schemaInternalV32, schemaInternalV42, schemaInternalV52, latestVersion, schemaInternal2, schemaV32, schemaV42, schemaV52, schema2, tableSquashed3, schemaSquashed2, drySQLite, sqliteSchemaV5, backwardCompatibleSqliteSchema;
5341
+ var index3, fk3, compositePK3, column3, tableV33, uniqueConstraint3, table3, dialect2, schemaHash3, schemaInternalV32, schemaInternalV42, schemaInternalV52, latestVersion, schemaInternal2, schemaV32, schemaV42, schemaV52, schema2, tableSquashed3, schemaSquashed2, drySQLite, sqliteSchemaV5, sqliteSchema, SQLiteSchemaSquashed, backwardCompatibleSqliteSchema;
5341
5342
  var init_sqliteSchema = __esm({
5342
5343
  "src/serializer/sqliteSchema.ts"() {
5343
5344
  "use strict";
@@ -5457,6 +5458,8 @@ var init_sqliteSchema = __esm({
5457
5458
  }
5458
5459
  });
5459
5460
  sqliteSchemaV5 = schemaV52;
5461
+ sqliteSchema = schema2;
5462
+ SQLiteSchemaSquashed = schemaSquashed2;
5460
5463
  backwardCompatibleSqliteSchema = unionType([sqliteSchemaV5, schema2]);
5461
5464
  }
5462
5465
  });
@@ -5530,10 +5533,100 @@ var init_serializer = __esm({
5530
5533
  }
5531
5534
  });
5532
5535
 
5536
+ // src/schemaValidator.ts
5537
+ var dialect3, commonSquashedSchema, commonSchema;
5538
+ var init_schemaValidator = __esm({
5539
+ "src/schemaValidator.ts"() {
5540
+ "use strict";
5541
+ init_lib();
5542
+ init_mysqlSchema();
5543
+ init_pgSchema();
5544
+ init_sqliteSchema();
5545
+ dialect3 = enumType(["postgresql", "mysql", "sqlite"]);
5546
+ commonSquashedSchema = unionType([
5547
+ pgSchemaSquashed,
5548
+ mysqlSchemaSquashed,
5549
+ SQLiteSchemaSquashed
5550
+ ]);
5551
+ commonSchema = unionType([
5552
+ pgSchema2,
5553
+ mysqlSchema,
5554
+ sqliteSchema
5555
+ ]);
5556
+ }
5557
+ });
5558
+
5559
+ // src/cli/validations/common.ts
5560
+ var sqliteDriversLiterals, sqliteDriver, postgresDriver, mysqlDriver, driver, configCommonSchema, casing, introspectParams, configIntrospectCliSchema, configGenerateSchema, configPushSchema;
5561
+ var init_common = __esm({
5562
+ "src/cli/validations/common.ts"() {
5563
+ "use strict";
5564
+ init_outputs();
5565
+ init_lib();
5566
+ init_schemaValidator();
5567
+ sqliteDriversLiterals = [
5568
+ literalType("turso"),
5569
+ literalType("d1-http"),
5570
+ literalType("expo")
5571
+ ];
5572
+ sqliteDriver = unionType(sqliteDriversLiterals);
5573
+ postgresDriver = literalType("aws-data-api");
5574
+ mysqlDriver = literalType("mysql2");
5575
+ driver = unionType([sqliteDriver, postgresDriver, mysqlDriver]);
5576
+ configCommonSchema = objectType({
5577
+ dialect: dialect3,
5578
+ schema: unionType([stringType(), stringType().array()]).optional(),
5579
+ out: stringType().optional(),
5580
+ breakpoints: booleanType().optional().default(true),
5581
+ driver: driver.optional(),
5582
+ tablesFilter: unionType([stringType(), stringType().array()]).optional(),
5583
+ schemaFilter: unionType([stringType(), stringType().array()]).default(["public"])
5584
+ });
5585
+ casing = unionType([literalType("camel"), literalType("preserve")]).default(
5586
+ "preserve"
5587
+ );
5588
+ introspectParams = objectType({
5589
+ schema: unionType([stringType(), stringType().array()]).optional(),
5590
+ out: stringType().optional().default("./drizzle"),
5591
+ breakpoints: booleanType().default(true),
5592
+ tablesFilter: unionType([stringType(), stringType().array()]).optional(),
5593
+ schemaFilter: unionType([stringType(), stringType().array()]).default(["public"]),
5594
+ introspect: objectType({
5595
+ casing
5596
+ }).default({ casing: "camel" })
5597
+ });
5598
+ configIntrospectCliSchema = objectType({
5599
+ schema: unionType([stringType(), stringType().array()]).optional(),
5600
+ out: stringType().optional().default("./drizzle"),
5601
+ breakpoints: booleanType().default(true),
5602
+ tablesFilter: unionType([stringType(), stringType().array()]).optional(),
5603
+ schemaFilter: unionType([stringType(), stringType().array()]).default(["public"]),
5604
+ introspectCasing: unionType([literalType("camel"), literalType("preserve")]).default(
5605
+ "camel"
5606
+ )
5607
+ });
5608
+ configGenerateSchema = objectType({
5609
+ schema: unionType([stringType(), stringType().array()]),
5610
+ out: stringType().optional().default("./drizzle"),
5611
+ breakpoints: booleanType().default(true)
5612
+ });
5613
+ configPushSchema = objectType({
5614
+ dialect: dialect3,
5615
+ schema: unionType([stringType(), stringType().array()]),
5616
+ tablesFilter: unionType([stringType(), stringType().array()]).optional(),
5617
+ schemaFilter: unionType([stringType(), stringType().array()]).default(["public"]),
5618
+ verbose: booleanType().default(false),
5619
+ strict: booleanType().default(false),
5620
+ out: stringType().optional()
5621
+ });
5622
+ }
5623
+ });
5624
+
5533
5625
  // src/cli/validations/outputs.ts
5534
5626
  var init_outputs = __esm({
5535
5627
  "src/cli/validations/outputs.ts"() {
5536
5628
  "use strict";
5629
+ init_common();
5537
5630
  }
5538
5631
  });
5539
5632
 
@@ -5579,7 +5672,7 @@ function mapSqlToSqliteType(sqlType) {
5579
5672
  return "numeric";
5580
5673
  }
5581
5674
  }
5582
- var import_drizzle_orm, import_sqlite_core2, dialect3, fromDatabase;
5675
+ var import_drizzle_orm, import_sqlite_core2, dialect4, fromDatabase;
5583
5676
  var init_sqliteSerializer = __esm({
5584
5677
  "src/serializer/sqliteSerializer.ts"() {
5585
5678
  "use strict";
@@ -5587,7 +5680,7 @@ var init_sqliteSerializer = __esm({
5587
5680
  import_sqlite_core2 = require("drizzle-orm/sqlite-core");
5588
5681
  init_serializer();
5589
5682
  init_outputs();
5590
- dialect3 = new import_sqlite_core2.SQLiteSyncDialect();
5683
+ dialect4 = new import_sqlite_core2.SQLiteSyncDialect();
5591
5684
  fromDatabase = async (db, tablesFilter = (table4) => true, progressCallback) => {
5592
5685
  const result = {};
5593
5686
  const columns = await db.query(
@@ -6019,7 +6112,7 @@ var init_vector = __esm({
6019
6112
  });
6020
6113
 
6021
6114
  // src/serializer/pgSerializer.ts
6022
- var import_pg_core2, import_pg_core3, import_drizzle_orm2, dialect4, trimChar, fromDatabase2, columnToDefault, defaultForColumn;
6115
+ var import_pg_core2, import_pg_core3, import_drizzle_orm2, dialect5, trimChar, fromDatabase2, columnToDefault, defaultForColumn;
6023
6116
  var init_pgSerializer = __esm({
6024
6117
  "src/serializer/pgSerializer.ts"() {
6025
6118
  "use strict";
@@ -6029,7 +6122,7 @@ var init_pgSerializer = __esm({
6029
6122
  init_serializer();
6030
6123
  init_outputs();
6031
6124
  init_vector();
6032
- dialect4 = new import_pg_core2.PgDialect();
6125
+ dialect5 = new import_pg_core2.PgDialect();
6033
6126
  trimChar = (str, char) => {
6034
6127
  let start = 0;
6035
6128
  let end = str.length;
@@ -6292,7 +6385,7 @@ var init_pgSerializer = __esm({
6292
6385
  name: columnName,
6293
6386
  type: (
6294
6387
  // filter vectors, but in future we should filter any extension that was installed by user
6295
- columnAdditionalDT === "USER-DEFINED" && enumType3 !== "vector" ? enumType3 : columnTypeMapped
6388
+ columnAdditionalDT === "USER-DEFINED" && !["vector", "geometry"].includes(enumType3) ? enumType3 : columnTypeMapped
6296
6389
  ),
6297
6390
  typeSchema: enumsToReturn[`${tableSchema}.${enumType3}`] !== void 0 ? enumsToReturn[`${tableSchema}.${enumType3}`].schema : void 0,
6298
6391
  primaryKey: primaryKey.length === 1 && cprimaryKey.length < 2,
package/utils-studio.mjs CHANGED
@@ -4849,7 +4849,7 @@ var init_lib = __esm({
4849
4849
  });
4850
4850
 
4851
4851
  // src/serializer/mysqlSchema.ts
4852
- var index, fk, column, tableV3, compositePK, uniqueConstraint, tableV4, table, kitInternals, dialect, schemaHash, schemaInternalV3, schemaInternalV4, schemaInternalV5, schemaInternal, schemaV3, schemaV4, schemaV5, schema, tableSquashedV4, tableSquashed, schemaSquashed, schemaSquashedV4, mysqlSchema, mysqlSchemaV5, backwardCompatibleMysqlSchema, dryMySql;
4852
+ var index, fk, column, tableV3, compositePK, uniqueConstraint, tableV4, table, kitInternals, dialect, schemaHash, schemaInternalV3, schemaInternalV4, schemaInternalV5, schemaInternal, schemaV3, schemaV4, schemaV5, schema, tableSquashedV4, tableSquashed, schemaSquashed, schemaSquashedV4, mysqlSchema, mysqlSchemaV5, mysqlSchemaSquashed, backwardCompatibleMysqlSchema, dryMySql;
4853
4853
  var init_mysqlSchema = __esm({
4854
4854
  "src/serializer/mysqlSchema.ts"() {
4855
4855
  "use strict";
@@ -4991,6 +4991,7 @@ var init_mysqlSchema = __esm({
4991
4991
  }).strict();
4992
4992
  mysqlSchema = schema;
4993
4993
  mysqlSchemaV5 = schemaV5;
4994
+ mysqlSchemaSquashed = schemaSquashed;
4994
4995
  backwardCompatibleMysqlSchema = unionType([mysqlSchemaV5, schema]);
4995
4996
  dryMySql = mysqlSchema.parse({
4996
4997
  version: "5",
@@ -5338,7 +5339,7 @@ var init_pgSchema = __esm({
5338
5339
  });
5339
5340
 
5340
5341
  // src/serializer/sqliteSchema.ts
5341
- var index3, fk3, compositePK3, column3, tableV33, uniqueConstraint3, table3, dialect2, schemaHash3, schemaInternalV32, schemaInternalV42, schemaInternalV52, latestVersion, schemaInternal2, schemaV32, schemaV42, schemaV52, schema2, tableSquashed3, schemaSquashed2, drySQLite, sqliteSchemaV5, backwardCompatibleSqliteSchema;
5342
+ var index3, fk3, compositePK3, column3, tableV33, uniqueConstraint3, table3, dialect2, schemaHash3, schemaInternalV32, schemaInternalV42, schemaInternalV52, latestVersion, schemaInternal2, schemaV32, schemaV42, schemaV52, schema2, tableSquashed3, schemaSquashed2, drySQLite, sqliteSchemaV5, sqliteSchema, SQLiteSchemaSquashed, backwardCompatibleSqliteSchema;
5342
5343
  var init_sqliteSchema = __esm({
5343
5344
  "src/serializer/sqliteSchema.ts"() {
5344
5345
  "use strict";
@@ -5458,6 +5459,8 @@ var init_sqliteSchema = __esm({
5458
5459
  }
5459
5460
  });
5460
5461
  sqliteSchemaV5 = schemaV52;
5462
+ sqliteSchema = schema2;
5463
+ SQLiteSchemaSquashed = schemaSquashed2;
5461
5464
  backwardCompatibleSqliteSchema = unionType([sqliteSchemaV5, schema2]);
5462
5465
  }
5463
5466
  });
@@ -5530,10 +5533,100 @@ var init_serializer = __esm({
5530
5533
  }
5531
5534
  });
5532
5535
 
5536
+ // src/schemaValidator.ts
5537
+ var dialect3, commonSquashedSchema, commonSchema;
5538
+ var init_schemaValidator = __esm({
5539
+ "src/schemaValidator.ts"() {
5540
+ "use strict";
5541
+ init_lib();
5542
+ init_mysqlSchema();
5543
+ init_pgSchema();
5544
+ init_sqliteSchema();
5545
+ dialect3 = enumType(["postgresql", "mysql", "sqlite"]);
5546
+ commonSquashedSchema = unionType([
5547
+ pgSchemaSquashed,
5548
+ mysqlSchemaSquashed,
5549
+ SQLiteSchemaSquashed
5550
+ ]);
5551
+ commonSchema = unionType([
5552
+ pgSchema2,
5553
+ mysqlSchema,
5554
+ sqliteSchema
5555
+ ]);
5556
+ }
5557
+ });
5558
+
5559
+ // src/cli/validations/common.ts
5560
+ var sqliteDriversLiterals, sqliteDriver, postgresDriver, mysqlDriver, driver, configCommonSchema, casing, introspectParams, configIntrospectCliSchema, configGenerateSchema, configPushSchema;
5561
+ var init_common = __esm({
5562
+ "src/cli/validations/common.ts"() {
5563
+ "use strict";
5564
+ init_outputs();
5565
+ init_lib();
5566
+ init_schemaValidator();
5567
+ sqliteDriversLiterals = [
5568
+ literalType("turso"),
5569
+ literalType("d1-http"),
5570
+ literalType("expo")
5571
+ ];
5572
+ sqliteDriver = unionType(sqliteDriversLiterals);
5573
+ postgresDriver = literalType("aws-data-api");
5574
+ mysqlDriver = literalType("mysql2");
5575
+ driver = unionType([sqliteDriver, postgresDriver, mysqlDriver]);
5576
+ configCommonSchema = objectType({
5577
+ dialect: dialect3,
5578
+ schema: unionType([stringType(), stringType().array()]).optional(),
5579
+ out: stringType().optional(),
5580
+ breakpoints: booleanType().optional().default(true),
5581
+ driver: driver.optional(),
5582
+ tablesFilter: unionType([stringType(), stringType().array()]).optional(),
5583
+ schemaFilter: unionType([stringType(), stringType().array()]).default(["public"])
5584
+ });
5585
+ casing = unionType([literalType("camel"), literalType("preserve")]).default(
5586
+ "preserve"
5587
+ );
5588
+ introspectParams = objectType({
5589
+ schema: unionType([stringType(), stringType().array()]).optional(),
5590
+ out: stringType().optional().default("./drizzle"),
5591
+ breakpoints: booleanType().default(true),
5592
+ tablesFilter: unionType([stringType(), stringType().array()]).optional(),
5593
+ schemaFilter: unionType([stringType(), stringType().array()]).default(["public"]),
5594
+ introspect: objectType({
5595
+ casing
5596
+ }).default({ casing: "camel" })
5597
+ });
5598
+ configIntrospectCliSchema = objectType({
5599
+ schema: unionType([stringType(), stringType().array()]).optional(),
5600
+ out: stringType().optional().default("./drizzle"),
5601
+ breakpoints: booleanType().default(true),
5602
+ tablesFilter: unionType([stringType(), stringType().array()]).optional(),
5603
+ schemaFilter: unionType([stringType(), stringType().array()]).default(["public"]),
5604
+ introspectCasing: unionType([literalType("camel"), literalType("preserve")]).default(
5605
+ "camel"
5606
+ )
5607
+ });
5608
+ configGenerateSchema = objectType({
5609
+ schema: unionType([stringType(), stringType().array()]),
5610
+ out: stringType().optional().default("./drizzle"),
5611
+ breakpoints: booleanType().default(true)
5612
+ });
5613
+ configPushSchema = objectType({
5614
+ dialect: dialect3,
5615
+ schema: unionType([stringType(), stringType().array()]),
5616
+ tablesFilter: unionType([stringType(), stringType().array()]).optional(),
5617
+ schemaFilter: unionType([stringType(), stringType().array()]).default(["public"]),
5618
+ verbose: booleanType().default(false),
5619
+ strict: booleanType().default(false),
5620
+ out: stringType().optional()
5621
+ });
5622
+ }
5623
+ });
5624
+
5533
5625
  // src/cli/validations/outputs.ts
5534
5626
  var init_outputs = __esm({
5535
5627
  "src/cli/validations/outputs.ts"() {
5536
5628
  "use strict";
5629
+ init_common();
5537
5630
  }
5538
5631
  });
5539
5632
 
@@ -5586,13 +5679,13 @@ function mapSqlToSqliteType(sqlType) {
5586
5679
  return "numeric";
5587
5680
  }
5588
5681
  }
5589
- var dialect3, fromDatabase;
5682
+ var dialect4, fromDatabase;
5590
5683
  var init_sqliteSerializer = __esm({
5591
5684
  "src/serializer/sqliteSerializer.ts"() {
5592
5685
  "use strict";
5593
5686
  init_serializer();
5594
5687
  init_outputs();
5595
- dialect3 = new SQLiteSyncDialect();
5688
+ dialect4 = new SQLiteSyncDialect();
5596
5689
  fromDatabase = async (db, tablesFilter = (table4) => true, progressCallback) => {
5597
5690
  const result = {};
5598
5691
  const columns = await db.query(
@@ -6031,14 +6124,14 @@ import {
6031
6124
  } from "drizzle-orm/pg-core";
6032
6125
  import { getTableConfig as getTableConfig2 } from "drizzle-orm/pg-core";
6033
6126
  import { is as is2, SQL as SQL2, getTableName as getTableName2 } from "drizzle-orm";
6034
- var dialect4, trimChar, fromDatabase2, columnToDefault, defaultForColumn;
6127
+ var dialect5, trimChar, fromDatabase2, columnToDefault, defaultForColumn;
6035
6128
  var init_pgSerializer = __esm({
6036
6129
  "src/serializer/pgSerializer.ts"() {
6037
6130
  "use strict";
6038
6131
  init_serializer();
6039
6132
  init_outputs();
6040
6133
  init_vector();
6041
- dialect4 = new PgDialect();
6134
+ dialect5 = new PgDialect();
6042
6135
  trimChar = (str, char) => {
6043
6136
  let start = 0;
6044
6137
  let end = str.length;
@@ -6301,7 +6394,7 @@ var init_pgSerializer = __esm({
6301
6394
  name: columnName,
6302
6395
  type: (
6303
6396
  // filter vectors, but in future we should filter any extension that was installed by user
6304
- columnAdditionalDT === "USER-DEFINED" && enumType3 !== "vector" ? enumType3 : columnTypeMapped
6397
+ columnAdditionalDT === "USER-DEFINED" && !["vector", "geometry"].includes(enumType3) ? enumType3 : columnTypeMapped
6305
6398
  ),
6306
6399
  typeSchema: enumsToReturn[`${tableSchema}.${enumType3}`] !== void 0 ? enumsToReturn[`${tableSchema}.${enumType3}`].schema : void 0,
6307
6400
  primaryKey: primaryKey.length === 1 && cprimaryKey.length < 2,