drizzle-kit 0.20.17-a2979a1 → 0.20.17-ae6e691
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.
- package/bin.cjs +34044 -26986
- package/index.d.mts +28 -60
- package/index.d.ts +28 -60
- package/package.json +5 -16
- package/payload.d.mts +987 -18
- package/payload.d.ts +987 -18
- package/payload.js +19096 -16804
- package/payload.mjs +19112 -16795
- package/utils-studio.js +17 -12
- package/utils-studio.mjs +17 -12
- package/utils.js +6 -6
- package/utils.mjs +6 -6
- package/@types/utils.d.ts +0 -12
- package/cli/commands/migrate.d.ts +0 -287
- package/cli/commands/mysqlIntrospect.d.ts +0 -50
- package/cli/commands/mysqlPushUtils.d.ts +0 -14
- package/cli/commands/pgIntrospect.d.ts +0 -59
- package/cli/commands/pgPushUtils.d.ts +0 -11
- package/cli/commands/sqliteIntrospect.d.ts +0 -103
- package/cli/commands/sqlitePushUtils.d.ts +0 -15
- package/cli/commands/utils.d.ts +0 -58
- package/cli/connections.d.ts +0 -13
- package/cli/selector-ui.d.ts +0 -13
- package/cli/utils.d.ts +0 -13
- package/cli/validations/cli.d.ts +0 -169
- package/cli/validations/common.d.ts +0 -214
- package/cli/validations/mysql.d.ts +0 -29
- package/cli/validations/outputs.d.ts +0 -42
- package/cli/validations/pg.d.ts +0 -46
- package/cli/validations/sqlite.d.ts +0 -22
- package/cli/views.d.ts +0 -63
- package/global.d.ts +0 -6
- package/introspect-sqlite.d.ts +0 -10
- package/jsonDiffer.d.ts +0 -61
- package/jsonStatements.d.ts +0 -376
- package/migrationPreparator.d.ts +0 -35
- package/schemaValidator.d.ts +0 -1316
- package/serializer/index.d.ts +0 -9
- package/serializer/mysqlImports.d.ts +0 -7
- package/serializer/mysqlSchema.d.ts +0 -4650
- package/serializer/mysqlSerializer.d.ts +0 -7
- package/serializer/pgImports.d.ts +0 -11
- package/serializer/pgSchema.d.ts +0 -4792
- package/serializer/pgSerializer.d.ts +0 -7
- package/serializer/schemaToDrizzle.d.ts +0 -7
- package/serializer/sqliteImports.d.ts +0 -7
- package/serializer/sqliteSchema.d.ts +0 -2801
- package/serializer/sqliteSerializer.d.ts +0 -6
- package/serializer/studio.d.ts +0 -51
- package/snapshotsDiffer.d.ts +0 -3937
- package/sqlgenerator.d.ts +0 -33
- package/utils/words.d.ts +0 -7
- package/utils-studio.d.mts +0 -4
- package/utils-studio.d.ts +0 -4
- package/utils.d.ts +0 -78
package/utils-studio.js
CHANGED
|
@@ -573,7 +573,7 @@ var init_global = __esm({
|
|
|
573
573
|
}
|
|
574
574
|
});
|
|
575
575
|
|
|
576
|
-
// node_modules/.pnpm/zod@3.23.
|
|
576
|
+
// node_modules/.pnpm/zod@3.23.5/node_modules/zod/lib/index.mjs
|
|
577
577
|
function getErrorMap() {
|
|
578
578
|
return overrideErrorMap;
|
|
579
579
|
}
|
|
@@ -744,7 +744,7 @@ function createZodEnum(values, params) {
|
|
|
744
744
|
}
|
|
745
745
|
var util, objectUtil, ZodParsedType, getParsedType, ZodIssueCode, ZodError, errorMap, overrideErrorMap, makeIssue, ParseStatus, INVALID, DIRTY, OK, isAborted, isDirty, isValid, isAsync, errorUtil, _ZodEnum_cache, _ZodNativeEnum_cache, ParseInputLazyPath, handleResult, ZodType, cuidRegex, cuid2Regex, ulidRegex, uuidRegex, nanoidRegex, durationRegex, emailRegex, _emojiRegex, emojiRegex, ipv4Regex, ipv6Regex, base64Regex, dateRegexSource, dateRegex, ZodString, ZodNumber, ZodBigInt, ZodBoolean, ZodDate, ZodSymbol, ZodUndefined, ZodNull, ZodAny, ZodUnknown, ZodNever, ZodVoid, ZodArray, ZodObject, ZodUnion, getDiscriminator, ZodDiscriminatedUnion, ZodIntersection, ZodTuple, ZodRecord, ZodMap, ZodSet, ZodFunction, ZodLazy, ZodLiteral, ZodEnum, ZodNativeEnum, ZodPromise, ZodEffects, ZodOptional, ZodNullable, ZodDefault, ZodCatch, ZodNaN, BRAND, ZodBranded, ZodPipeline, ZodReadonly, late, ZodFirstPartyTypeKind, stringType, numberType, nanType, bigIntType, booleanType, dateType, symbolType, undefinedType, nullType, anyType, unknownType, neverType, voidType, arrayType, objectType, strictObjectType, unionType, discriminatedUnionType, intersectionType, tupleType, recordType, mapType, setType, functionType, lazyType, literalType, enumType, nativeEnumType, promiseType, effectsType, optionalType, nullableType, preprocessType, pipelineType;
|
|
746
746
|
var init_lib = __esm({
|
|
747
|
-
"node_modules/.pnpm/zod@3.23.
|
|
747
|
+
"node_modules/.pnpm/zod@3.23.5/node_modules/zod/lib/index.mjs"() {
|
|
748
748
|
(function(util2) {
|
|
749
749
|
util2.assertEqual = (val) => val;
|
|
750
750
|
function assertIs(_arg) {
|
|
@@ -4679,7 +4679,7 @@ var init_pgSchema = __esm({
|
|
|
4679
4679
|
}).strict();
|
|
4680
4680
|
pgSchemaInternal = objectType({
|
|
4681
4681
|
version: literalType("6"),
|
|
4682
|
-
dialect: literalType("
|
|
4682
|
+
dialect: literalType("postgresql"),
|
|
4683
4683
|
tables: recordType(stringType(), table2),
|
|
4684
4684
|
enums: recordType(stringType(), enumSchema),
|
|
4685
4685
|
schemas: recordType(stringType(), stringType()),
|
|
@@ -4708,14 +4708,14 @@ var init_pgSchema = __esm({
|
|
|
4708
4708
|
}).strict();
|
|
4709
4709
|
pgSchemaSquashedV4 = objectType({
|
|
4710
4710
|
version: literalType("4"),
|
|
4711
|
-
dialect:
|
|
4711
|
+
dialect: literalType("pg"),
|
|
4712
4712
|
tables: recordType(stringType(), tableSquashedV42),
|
|
4713
4713
|
enums: recordType(stringType(), enumSchemaV1),
|
|
4714
4714
|
schemas: recordType(stringType(), stringType())
|
|
4715
4715
|
}).strict();
|
|
4716
4716
|
pgSchemaSquashed = objectType({
|
|
4717
4717
|
version: literalType("6"),
|
|
4718
|
-
dialect:
|
|
4718
|
+
dialect: literalType("postgresql"),
|
|
4719
4719
|
tables: recordType(stringType(), tableSquashed2),
|
|
4720
4720
|
enums: recordType(stringType(), enumSchema),
|
|
4721
4721
|
schemas: recordType(stringType(), stringType())
|
|
@@ -4727,7 +4727,7 @@ var init_pgSchema = __esm({
|
|
|
4727
4727
|
backwardCompatiblePgSchema = unionType([pgSchemaV5, pgSchema2]);
|
|
4728
4728
|
dryPg = pgSchema2.parse({
|
|
4729
4729
|
version: snapshotVersion,
|
|
4730
|
-
dialect: "
|
|
4730
|
+
dialect: "postgresql",
|
|
4731
4731
|
id: originUUID,
|
|
4732
4732
|
prevId: "",
|
|
4733
4733
|
tables: {},
|
|
@@ -4927,7 +4927,9 @@ function mapSqlToSqliteType(sqlType) {
|
|
|
4927
4927
|
return "text";
|
|
4928
4928
|
} else if (lowered.startsWith("blob")) {
|
|
4929
4929
|
return "blob";
|
|
4930
|
-
} else if (["real", "double", "double precision", "float"].some(
|
|
4930
|
+
} else if (["real", "double", "double precision", "float"].some(
|
|
4931
|
+
(it) => lowered.startsWith(it)
|
|
4932
|
+
)) {
|
|
4931
4933
|
return "real";
|
|
4932
4934
|
} else {
|
|
4933
4935
|
return "numeric";
|
|
@@ -4948,7 +4950,7 @@ var init_sqliteSerializer = __esm({
|
|
|
4948
4950
|
`SELECT
|
|
4949
4951
|
m.name as "tableName", p.name as "columnName", p.type as "columnType", p."notnull" as "notNull", p.dflt_value as "defaultValue", p.pk as pk
|
|
4950
4952
|
FROM sqlite_master AS m JOIN pragma_table_info(m.name) AS p
|
|
4951
|
-
WHERE m.type = 'table' and m.tbl_name != 'sqlite_sequence' and m.tbl_name != 'sqlite_stat1' and m.tbl_name != '_litestream_seq' and m.tbl_name != '_litestream_lock' and m.tbl_name != 'libsql_wasm_func_table';
|
|
4953
|
+
WHERE m.type = 'table' and m.tbl_name != 'sqlite_sequence' and m.tbl_name != 'sqlite_stat1' and m.tbl_name != '_litestream_seq' and m.tbl_name != '_litestream_lock' and m.tbl_name != 'libsql_wasm_func_table' and m.tbl_name != '__drizzle_migrations';
|
|
4952
4954
|
`
|
|
4953
4955
|
);
|
|
4954
4956
|
const tablesWithSeq = [];
|
|
@@ -5557,7 +5559,7 @@ var init_pgSerializer = __esm({
|
|
|
5557
5559
|
const columnName = columnResponse.attname;
|
|
5558
5560
|
const columnAdditionalDT = columnResponse.additional_dt;
|
|
5559
5561
|
const columnDimensions = columnResponse.array_dimensions;
|
|
5560
|
-
const
|
|
5562
|
+
const enumType3 = columnResponse.enum_name;
|
|
5561
5563
|
let columnType = columnResponse.data_type;
|
|
5562
5564
|
const primaryKey = tableConstraints.filter(
|
|
5563
5565
|
(mapRow) => columnName === mapRow.column_name && mapRow.constraint_type === "PRIMARY KEY"
|
|
@@ -5621,8 +5623,8 @@ var init_pgSerializer = __esm({
|
|
|
5621
5623
|
columnTypeMapped = trimChar(columnTypeMapped, '"');
|
|
5622
5624
|
columnToReturn[columnName] = {
|
|
5623
5625
|
name: columnName,
|
|
5624
|
-
type: columnAdditionalDT === "USER-DEFINED" ?
|
|
5625
|
-
typeSchema: enumsToReturn[`${tableSchema}.${
|
|
5626
|
+
type: columnAdditionalDT === "USER-DEFINED" ? enumType3 : columnTypeMapped,
|
|
5627
|
+
typeSchema: enumsToReturn[`${tableSchema}.${enumType3}`] !== void 0 ? enumsToReturn[`${tableSchema}.${enumType3}`].schema : void 0,
|
|
5626
5628
|
primaryKey: primaryKey.length === 1 && cprimaryKey.length < 2,
|
|
5627
5629
|
// default: isSerial ? undefined : defaultValue,
|
|
5628
5630
|
notNull: columnResponse.is_nullable === "NO"
|
|
@@ -5705,7 +5707,7 @@ var init_pgSerializer = __esm({
|
|
|
5705
5707
|
const schemasObject = Object.fromEntries([...schemas].map((it) => [it, it]));
|
|
5706
5708
|
return {
|
|
5707
5709
|
version: "6",
|
|
5708
|
-
dialect: "
|
|
5710
|
+
dialect: "postgresql",
|
|
5709
5711
|
tables: result,
|
|
5710
5712
|
enums: enumsToReturn,
|
|
5711
5713
|
schemas: schemasObject,
|
|
@@ -6039,6 +6041,9 @@ String.prototype.squashSpaces = function() {
|
|
|
6039
6041
|
String.prototype.camelCase = function() {
|
|
6040
6042
|
return camelCase(String(this));
|
|
6041
6043
|
};
|
|
6044
|
+
String.prototype.capitalise = function() {
|
|
6045
|
+
return this && this.length > 0 ? `${this[0].toUpperCase()}${this.slice(1)}` : String(this);
|
|
6046
|
+
};
|
|
6042
6047
|
String.prototype.concatIf = function(it, condition) {
|
|
6043
6048
|
return condition ? `${this}${it}` : String(this);
|
|
6044
6049
|
};
|
package/utils-studio.mjs
CHANGED
|
@@ -574,7 +574,7 @@ var init_global = __esm({
|
|
|
574
574
|
}
|
|
575
575
|
});
|
|
576
576
|
|
|
577
|
-
// node_modules/.pnpm/zod@3.23.
|
|
577
|
+
// node_modules/.pnpm/zod@3.23.5/node_modules/zod/lib/index.mjs
|
|
578
578
|
function getErrorMap() {
|
|
579
579
|
return overrideErrorMap;
|
|
580
580
|
}
|
|
@@ -745,7 +745,7 @@ function createZodEnum(values, params) {
|
|
|
745
745
|
}
|
|
746
746
|
var util, objectUtil, ZodParsedType, getParsedType, ZodIssueCode, ZodError, errorMap, overrideErrorMap, makeIssue, ParseStatus, INVALID, DIRTY, OK, isAborted, isDirty, isValid, isAsync, errorUtil, _ZodEnum_cache, _ZodNativeEnum_cache, ParseInputLazyPath, handleResult, ZodType, cuidRegex, cuid2Regex, ulidRegex, uuidRegex, nanoidRegex, durationRegex, emailRegex, _emojiRegex, emojiRegex, ipv4Regex, ipv6Regex, base64Regex, dateRegexSource, dateRegex, ZodString, ZodNumber, ZodBigInt, ZodBoolean, ZodDate, ZodSymbol, ZodUndefined, ZodNull, ZodAny, ZodUnknown, ZodNever, ZodVoid, ZodArray, ZodObject, ZodUnion, getDiscriminator, ZodDiscriminatedUnion, ZodIntersection, ZodTuple, ZodRecord, ZodMap, ZodSet, ZodFunction, ZodLazy, ZodLiteral, ZodEnum, ZodNativeEnum, ZodPromise, ZodEffects, ZodOptional, ZodNullable, ZodDefault, ZodCatch, ZodNaN, BRAND, ZodBranded, ZodPipeline, ZodReadonly, late, ZodFirstPartyTypeKind, stringType, numberType, nanType, bigIntType, booleanType, dateType, symbolType, undefinedType, nullType, anyType, unknownType, neverType, voidType, arrayType, objectType, strictObjectType, unionType, discriminatedUnionType, intersectionType, tupleType, recordType, mapType, setType, functionType, lazyType, literalType, enumType, nativeEnumType, promiseType, effectsType, optionalType, nullableType, preprocessType, pipelineType;
|
|
747
747
|
var init_lib = __esm({
|
|
748
|
-
"node_modules/.pnpm/zod@3.23.
|
|
748
|
+
"node_modules/.pnpm/zod@3.23.5/node_modules/zod/lib/index.mjs"() {
|
|
749
749
|
(function(util2) {
|
|
750
750
|
util2.assertEqual = (val) => val;
|
|
751
751
|
function assertIs(_arg) {
|
|
@@ -4680,7 +4680,7 @@ var init_pgSchema = __esm({
|
|
|
4680
4680
|
}).strict();
|
|
4681
4681
|
pgSchemaInternal = objectType({
|
|
4682
4682
|
version: literalType("6"),
|
|
4683
|
-
dialect: literalType("
|
|
4683
|
+
dialect: literalType("postgresql"),
|
|
4684
4684
|
tables: recordType(stringType(), table2),
|
|
4685
4685
|
enums: recordType(stringType(), enumSchema),
|
|
4686
4686
|
schemas: recordType(stringType(), stringType()),
|
|
@@ -4709,14 +4709,14 @@ var init_pgSchema = __esm({
|
|
|
4709
4709
|
}).strict();
|
|
4710
4710
|
pgSchemaSquashedV4 = objectType({
|
|
4711
4711
|
version: literalType("4"),
|
|
4712
|
-
dialect:
|
|
4712
|
+
dialect: literalType("pg"),
|
|
4713
4713
|
tables: recordType(stringType(), tableSquashedV42),
|
|
4714
4714
|
enums: recordType(stringType(), enumSchemaV1),
|
|
4715
4715
|
schemas: recordType(stringType(), stringType())
|
|
4716
4716
|
}).strict();
|
|
4717
4717
|
pgSchemaSquashed = objectType({
|
|
4718
4718
|
version: literalType("6"),
|
|
4719
|
-
dialect:
|
|
4719
|
+
dialect: literalType("postgresql"),
|
|
4720
4720
|
tables: recordType(stringType(), tableSquashed2),
|
|
4721
4721
|
enums: recordType(stringType(), enumSchema),
|
|
4722
4722
|
schemas: recordType(stringType(), stringType())
|
|
@@ -4728,7 +4728,7 @@ var init_pgSchema = __esm({
|
|
|
4728
4728
|
backwardCompatiblePgSchema = unionType([pgSchemaV5, pgSchema2]);
|
|
4729
4729
|
dryPg = pgSchema2.parse({
|
|
4730
4730
|
version: snapshotVersion,
|
|
4731
|
-
dialect: "
|
|
4731
|
+
dialect: "postgresql",
|
|
4732
4732
|
id: originUUID,
|
|
4733
4733
|
prevId: "",
|
|
4734
4734
|
tables: {},
|
|
@@ -4934,7 +4934,9 @@ function mapSqlToSqliteType(sqlType) {
|
|
|
4934
4934
|
return "text";
|
|
4935
4935
|
} else if (lowered.startsWith("blob")) {
|
|
4936
4936
|
return "blob";
|
|
4937
|
-
} else if (["real", "double", "double precision", "float"].some(
|
|
4937
|
+
} else if (["real", "double", "double precision", "float"].some(
|
|
4938
|
+
(it) => lowered.startsWith(it)
|
|
4939
|
+
)) {
|
|
4938
4940
|
return "real";
|
|
4939
4941
|
} else {
|
|
4940
4942
|
return "numeric";
|
|
@@ -4953,7 +4955,7 @@ var init_sqliteSerializer = __esm({
|
|
|
4953
4955
|
`SELECT
|
|
4954
4956
|
m.name as "tableName", p.name as "columnName", p.type as "columnType", p."notnull" as "notNull", p.dflt_value as "defaultValue", p.pk as pk
|
|
4955
4957
|
FROM sqlite_master AS m JOIN pragma_table_info(m.name) AS p
|
|
4956
|
-
WHERE m.type = 'table' and m.tbl_name != 'sqlite_sequence' and m.tbl_name != 'sqlite_stat1' and m.tbl_name != '_litestream_seq' and m.tbl_name != '_litestream_lock' and m.tbl_name != 'libsql_wasm_func_table';
|
|
4958
|
+
WHERE m.type = 'table' and m.tbl_name != 'sqlite_sequence' and m.tbl_name != 'sqlite_stat1' and m.tbl_name != '_litestream_seq' and m.tbl_name != '_litestream_lock' and m.tbl_name != 'libsql_wasm_func_table' and m.tbl_name != '__drizzle_migrations';
|
|
4957
4959
|
`
|
|
4958
4960
|
);
|
|
4959
4961
|
const tablesWithSeq = [];
|
|
@@ -5566,7 +5568,7 @@ var init_pgSerializer = __esm({
|
|
|
5566
5568
|
const columnName = columnResponse.attname;
|
|
5567
5569
|
const columnAdditionalDT = columnResponse.additional_dt;
|
|
5568
5570
|
const columnDimensions = columnResponse.array_dimensions;
|
|
5569
|
-
const
|
|
5571
|
+
const enumType3 = columnResponse.enum_name;
|
|
5570
5572
|
let columnType = columnResponse.data_type;
|
|
5571
5573
|
const primaryKey = tableConstraints.filter(
|
|
5572
5574
|
(mapRow) => columnName === mapRow.column_name && mapRow.constraint_type === "PRIMARY KEY"
|
|
@@ -5630,8 +5632,8 @@ var init_pgSerializer = __esm({
|
|
|
5630
5632
|
columnTypeMapped = trimChar(columnTypeMapped, '"');
|
|
5631
5633
|
columnToReturn[columnName] = {
|
|
5632
5634
|
name: columnName,
|
|
5633
|
-
type: columnAdditionalDT === "USER-DEFINED" ?
|
|
5634
|
-
typeSchema: enumsToReturn[`${tableSchema}.${
|
|
5635
|
+
type: columnAdditionalDT === "USER-DEFINED" ? enumType3 : columnTypeMapped,
|
|
5636
|
+
typeSchema: enumsToReturn[`${tableSchema}.${enumType3}`] !== void 0 ? enumsToReturn[`${tableSchema}.${enumType3}`].schema : void 0,
|
|
5635
5637
|
primaryKey: primaryKey.length === 1 && cprimaryKey.length < 2,
|
|
5636
5638
|
// default: isSerial ? undefined : defaultValue,
|
|
5637
5639
|
notNull: columnResponse.is_nullable === "NO"
|
|
@@ -5714,7 +5716,7 @@ var init_pgSerializer = __esm({
|
|
|
5714
5716
|
const schemasObject = Object.fromEntries([...schemas].map((it) => [it, it]));
|
|
5715
5717
|
return {
|
|
5716
5718
|
version: "6",
|
|
5717
|
-
dialect: "
|
|
5719
|
+
dialect: "postgresql",
|
|
5718
5720
|
tables: result,
|
|
5719
5721
|
enums: enumsToReturn,
|
|
5720
5722
|
schemas: schemasObject,
|
|
@@ -6075,6 +6077,9 @@ String.prototype.squashSpaces = function() {
|
|
|
6075
6077
|
String.prototype.camelCase = function() {
|
|
6076
6078
|
return camelCase(String(this));
|
|
6077
6079
|
};
|
|
6080
|
+
String.prototype.capitalise = function() {
|
|
6081
|
+
return this && this.length > 0 ? `${this[0].toUpperCase()}${this.slice(1)}` : String(this);
|
|
6082
|
+
};
|
|
6078
6083
|
String.prototype.concatIf = function(it, condition) {
|
|
6079
6084
|
return condition ? `${this}${it}` : String(this);
|
|
6080
6085
|
};
|
package/utils.js
CHANGED
|
@@ -1079,7 +1079,7 @@ var info = (msg, greyMsg = "") => {
|
|
|
1079
1079
|
var originUUID = "00000000-0000-0000-0000-000000000000";
|
|
1080
1080
|
var snapshotVersion = "6";
|
|
1081
1081
|
|
|
1082
|
-
// node_modules/.pnpm/zod@3.23.
|
|
1082
|
+
// node_modules/.pnpm/zod@3.23.5/node_modules/zod/lib/index.mjs
|
|
1083
1083
|
var util;
|
|
1084
1084
|
(function(util2) {
|
|
1085
1085
|
util2.assertEqual = (val) => val;
|
|
@@ -5173,7 +5173,7 @@ var pgSchemaExternal = objectType({
|
|
|
5173
5173
|
}).strict();
|
|
5174
5174
|
var pgSchemaInternal = objectType({
|
|
5175
5175
|
version: literalType("6"),
|
|
5176
|
-
dialect: literalType("
|
|
5176
|
+
dialect: literalType("postgresql"),
|
|
5177
5177
|
tables: recordType(stringType(), table2),
|
|
5178
5178
|
enums: recordType(stringType(), enumSchema),
|
|
5179
5179
|
schemas: recordType(stringType(), stringType()),
|
|
@@ -5202,14 +5202,14 @@ var tableSquashedV42 = objectType({
|
|
|
5202
5202
|
}).strict();
|
|
5203
5203
|
var pgSchemaSquashedV4 = objectType({
|
|
5204
5204
|
version: literalType("4"),
|
|
5205
|
-
dialect:
|
|
5205
|
+
dialect: literalType("pg"),
|
|
5206
5206
|
tables: recordType(stringType(), tableSquashedV42),
|
|
5207
5207
|
enums: recordType(stringType(), enumSchemaV1),
|
|
5208
5208
|
schemas: recordType(stringType(), stringType())
|
|
5209
5209
|
}).strict();
|
|
5210
5210
|
var pgSchemaSquashed = objectType({
|
|
5211
5211
|
version: literalType("6"),
|
|
5212
|
-
dialect:
|
|
5212
|
+
dialect: literalType("postgresql"),
|
|
5213
5213
|
tables: recordType(stringType(), tableSquashed2),
|
|
5214
5214
|
enums: recordType(stringType(), enumSchema),
|
|
5215
5215
|
schemas: recordType(stringType(), stringType())
|
|
@@ -5221,7 +5221,7 @@ var pgSchema = pgSchemaInternal.merge(schemaHash2);
|
|
|
5221
5221
|
var backwardCompatiblePgSchema = unionType([pgSchemaV5, pgSchema]);
|
|
5222
5222
|
var dryPg = pgSchema.parse({
|
|
5223
5223
|
version: snapshotVersion,
|
|
5224
|
-
dialect: "
|
|
5224
|
+
dialect: "postgresql",
|
|
5225
5225
|
id: originUUID,
|
|
5226
5226
|
prevId: "",
|
|
5227
5227
|
tables: {},
|
|
@@ -5383,7 +5383,7 @@ var prepareOutFolder = (out, dialect3) => {
|
|
|
5383
5383
|
};
|
|
5384
5384
|
var validatorForDialect = (dialect3) => {
|
|
5385
5385
|
switch (dialect3) {
|
|
5386
|
-
case "
|
|
5386
|
+
case "postgresql":
|
|
5387
5387
|
return { validator: backwardCompatiblePgSchema, version: 6 };
|
|
5388
5388
|
case "sqlite":
|
|
5389
5389
|
return { validator: backwardCompatibleSqliteSchema, version: 5 };
|
package/utils.mjs
CHANGED
|
@@ -1070,7 +1070,7 @@ var info = (msg, greyMsg = "") => {
|
|
|
1070
1070
|
var originUUID = "00000000-0000-0000-0000-000000000000";
|
|
1071
1071
|
var snapshotVersion = "6";
|
|
1072
1072
|
|
|
1073
|
-
// node_modules/.pnpm/zod@3.23.
|
|
1073
|
+
// node_modules/.pnpm/zod@3.23.5/node_modules/zod/lib/index.mjs
|
|
1074
1074
|
var util;
|
|
1075
1075
|
(function(util2) {
|
|
1076
1076
|
util2.assertEqual = (val) => val;
|
|
@@ -5164,7 +5164,7 @@ var pgSchemaExternal = objectType({
|
|
|
5164
5164
|
}).strict();
|
|
5165
5165
|
var pgSchemaInternal = objectType({
|
|
5166
5166
|
version: literalType("6"),
|
|
5167
|
-
dialect: literalType("
|
|
5167
|
+
dialect: literalType("postgresql"),
|
|
5168
5168
|
tables: recordType(stringType(), table2),
|
|
5169
5169
|
enums: recordType(stringType(), enumSchema),
|
|
5170
5170
|
schemas: recordType(stringType(), stringType()),
|
|
@@ -5193,14 +5193,14 @@ var tableSquashedV42 = objectType({
|
|
|
5193
5193
|
}).strict();
|
|
5194
5194
|
var pgSchemaSquashedV4 = objectType({
|
|
5195
5195
|
version: literalType("4"),
|
|
5196
|
-
dialect:
|
|
5196
|
+
dialect: literalType("pg"),
|
|
5197
5197
|
tables: recordType(stringType(), tableSquashedV42),
|
|
5198
5198
|
enums: recordType(stringType(), enumSchemaV1),
|
|
5199
5199
|
schemas: recordType(stringType(), stringType())
|
|
5200
5200
|
}).strict();
|
|
5201
5201
|
var pgSchemaSquashed = objectType({
|
|
5202
5202
|
version: literalType("6"),
|
|
5203
|
-
dialect:
|
|
5203
|
+
dialect: literalType("postgresql"),
|
|
5204
5204
|
tables: recordType(stringType(), tableSquashed2),
|
|
5205
5205
|
enums: recordType(stringType(), enumSchema),
|
|
5206
5206
|
schemas: recordType(stringType(), stringType())
|
|
@@ -5212,7 +5212,7 @@ var pgSchema = pgSchemaInternal.merge(schemaHash2);
|
|
|
5212
5212
|
var backwardCompatiblePgSchema = unionType([pgSchemaV5, pgSchema]);
|
|
5213
5213
|
var dryPg = pgSchema.parse({
|
|
5214
5214
|
version: snapshotVersion,
|
|
5215
|
-
dialect: "
|
|
5215
|
+
dialect: "postgresql",
|
|
5216
5216
|
id: originUUID,
|
|
5217
5217
|
prevId: "",
|
|
5218
5218
|
tables: {},
|
|
@@ -5374,7 +5374,7 @@ var prepareOutFolder = (out, dialect3) => {
|
|
|
5374
5374
|
};
|
|
5375
5375
|
var validatorForDialect = (dialect3) => {
|
|
5376
5376
|
switch (dialect3) {
|
|
5377
|
-
case "
|
|
5377
|
+
case "postgresql":
|
|
5378
5378
|
return { validator: backwardCompatiblePgSchema, version: 6 };
|
|
5379
5379
|
case "sqlite":
|
|
5380
5380
|
return { validator: backwardCompatibleSqliteSchema, version: 5 };
|
package/@types/utils.d.ts
DELETED
|
@@ -1,287 +0,0 @@
|
|
|
1
|
-
import { Column, ColumnsResolverInput, ColumnsResolverOutput, Enum, ResolverInput, ResolverOutput, ResolverOutputWithMoved, Table } from "../../snapshotsDiffer";
|
|
2
|
-
import type { CommonSchema } from "../../schemaValidator";
|
|
3
|
-
import { PgSchema } from "../../serializer/pgSchema";
|
|
4
|
-
import { SQLiteSchema } from "../../serializer/sqliteSchema";
|
|
5
|
-
import { MySqlSchema } from "../../serializer/mysqlSchema";
|
|
6
|
-
import { Journal } from "../../utils";
|
|
7
|
-
import { GenerateConfig } from "./utils";
|
|
8
|
-
export type Named = {
|
|
9
|
-
name: string;
|
|
10
|
-
};
|
|
11
|
-
export type NamedWithSchema = {
|
|
12
|
-
name: string;
|
|
13
|
-
schema: string;
|
|
14
|
-
};
|
|
15
|
-
export declare const schemasResolver: (input: ResolverInput<Table>) => Promise<ResolverOutput<Table>>;
|
|
16
|
-
export declare const tablesResolver: (input: ResolverInput<Table>) => Promise<ResolverOutputWithMoved<Table>>;
|
|
17
|
-
export declare const enumsResolver: (input: ResolverInput<Enum>) => Promise<ResolverOutputWithMoved<Enum>>;
|
|
18
|
-
export declare const columnsResolver: (input: ColumnsResolverInput<Column>) => Promise<ColumnsResolverOutput<Column>>;
|
|
19
|
-
export declare const prepareAndMigratePg: (config: GenerateConfig) => Promise<void>;
|
|
20
|
-
export declare const preparePgPush: (schemaPath: string | string[], snapshot: PgSchema, schemaFilter: string[]) => Promise<{
|
|
21
|
-
sqlStatements: string[];
|
|
22
|
-
statements: import("../../jsonStatements").JsonStatement[];
|
|
23
|
-
squashedPrev: {
|
|
24
|
-
tables: Record<string, {
|
|
25
|
-
name: string;
|
|
26
|
-
columns: Record<string, {
|
|
27
|
-
name: string;
|
|
28
|
-
type: string;
|
|
29
|
-
primaryKey: boolean;
|
|
30
|
-
notNull: boolean;
|
|
31
|
-
isUnique?: any;
|
|
32
|
-
default?: any;
|
|
33
|
-
typeSchema?: string | undefined;
|
|
34
|
-
uniqueName?: string | undefined;
|
|
35
|
-
nullsNotDistinct?: boolean | undefined;
|
|
36
|
-
}>;
|
|
37
|
-
indexes: Record<string, string>;
|
|
38
|
-
foreignKeys: Record<string, string>;
|
|
39
|
-
schema: string;
|
|
40
|
-
compositePrimaryKeys: Record<string, string>;
|
|
41
|
-
uniqueConstraints: Record<string, string>;
|
|
42
|
-
}>;
|
|
43
|
-
version: "6";
|
|
44
|
-
dialect: "pg";
|
|
45
|
-
schemas: Record<string, string>;
|
|
46
|
-
enums: Record<string, {
|
|
47
|
-
name: string;
|
|
48
|
-
values: string[];
|
|
49
|
-
schema: string;
|
|
50
|
-
}>;
|
|
51
|
-
};
|
|
52
|
-
squashedCur: {
|
|
53
|
-
tables: Record<string, {
|
|
54
|
-
name: string;
|
|
55
|
-
columns: Record<string, {
|
|
56
|
-
name: string;
|
|
57
|
-
type: string;
|
|
58
|
-
primaryKey: boolean;
|
|
59
|
-
notNull: boolean;
|
|
60
|
-
isUnique?: any;
|
|
61
|
-
default?: any;
|
|
62
|
-
typeSchema?: string | undefined;
|
|
63
|
-
uniqueName?: string | undefined;
|
|
64
|
-
nullsNotDistinct?: boolean | undefined;
|
|
65
|
-
}>;
|
|
66
|
-
indexes: Record<string, string>;
|
|
67
|
-
foreignKeys: Record<string, string>;
|
|
68
|
-
schema: string;
|
|
69
|
-
compositePrimaryKeys: Record<string, string>;
|
|
70
|
-
uniqueConstraints: Record<string, string>;
|
|
71
|
-
}>;
|
|
72
|
-
version: "6";
|
|
73
|
-
dialect: "pg";
|
|
74
|
-
schemas: Record<string, string>;
|
|
75
|
-
enums: Record<string, {
|
|
76
|
-
name: string;
|
|
77
|
-
values: string[];
|
|
78
|
-
schema: string;
|
|
79
|
-
}>;
|
|
80
|
-
};
|
|
81
|
-
}>;
|
|
82
|
-
export declare const prepareMySQLPush: (schemaPath: string | string[], snapshot: MySqlSchema) => Promise<{
|
|
83
|
-
sqlStatements: string[];
|
|
84
|
-
statements: import("../../jsonStatements").JsonStatement[];
|
|
85
|
-
validatedCur: {
|
|
86
|
-
tables: Record<string, {
|
|
87
|
-
name: string;
|
|
88
|
-
columns: Record<string, {
|
|
89
|
-
name: string;
|
|
90
|
-
type: string;
|
|
91
|
-
primaryKey: boolean;
|
|
92
|
-
notNull: boolean;
|
|
93
|
-
default?: any;
|
|
94
|
-
onUpdate?: any;
|
|
95
|
-
autoincrement?: boolean | undefined;
|
|
96
|
-
}>;
|
|
97
|
-
indexes: Record<string, {
|
|
98
|
-
name: string;
|
|
99
|
-
columns: string[];
|
|
100
|
-
isUnique: boolean;
|
|
101
|
-
using?: "btree" | "hash" | undefined;
|
|
102
|
-
algorithm?: "default" | "inplace" | "copy" | undefined;
|
|
103
|
-
lock?: "default" | "none" | "shared" | "exclusive" | undefined;
|
|
104
|
-
}>;
|
|
105
|
-
foreignKeys: Record<string, {
|
|
106
|
-
name: string;
|
|
107
|
-
tableFrom: string;
|
|
108
|
-
columnsFrom: string[];
|
|
109
|
-
tableTo: string;
|
|
110
|
-
columnsTo: string[];
|
|
111
|
-
onUpdate?: string | undefined;
|
|
112
|
-
onDelete?: string | undefined;
|
|
113
|
-
}>;
|
|
114
|
-
compositePrimaryKeys: Record<string, {
|
|
115
|
-
name: string;
|
|
116
|
-
columns: string[];
|
|
117
|
-
}>;
|
|
118
|
-
uniqueConstraints: Record<string, {
|
|
119
|
-
name: string;
|
|
120
|
-
columns: string[];
|
|
121
|
-
}>;
|
|
122
|
-
}>;
|
|
123
|
-
id: string;
|
|
124
|
-
prevId: string;
|
|
125
|
-
version: "5";
|
|
126
|
-
dialect: "mysql";
|
|
127
|
-
_meta: {
|
|
128
|
-
columns: Record<string, string>;
|
|
129
|
-
tables: Record<string, string>;
|
|
130
|
-
};
|
|
131
|
-
internal?: {
|
|
132
|
-
tables: Record<string, {
|
|
133
|
-
columns: Record<string, {
|
|
134
|
-
isDefaultAnExpression?: boolean | undefined;
|
|
135
|
-
} | undefined>;
|
|
136
|
-
} | undefined>;
|
|
137
|
-
} | undefined;
|
|
138
|
-
};
|
|
139
|
-
validatedPrev: {
|
|
140
|
-
tables: Record<string, {
|
|
141
|
-
name: string;
|
|
142
|
-
columns: Record<string, {
|
|
143
|
-
name: string;
|
|
144
|
-
type: string;
|
|
145
|
-
primaryKey: boolean;
|
|
146
|
-
notNull: boolean;
|
|
147
|
-
default?: any;
|
|
148
|
-
onUpdate?: any;
|
|
149
|
-
autoincrement?: boolean | undefined;
|
|
150
|
-
}>;
|
|
151
|
-
indexes: Record<string, {
|
|
152
|
-
name: string;
|
|
153
|
-
columns: string[];
|
|
154
|
-
isUnique: boolean;
|
|
155
|
-
using?: "btree" | "hash" | undefined;
|
|
156
|
-
algorithm?: "default" | "inplace" | "copy" | undefined;
|
|
157
|
-
lock?: "default" | "none" | "shared" | "exclusive" | undefined;
|
|
158
|
-
}>;
|
|
159
|
-
foreignKeys: Record<string, {
|
|
160
|
-
name: string;
|
|
161
|
-
tableFrom: string;
|
|
162
|
-
columnsFrom: string[];
|
|
163
|
-
tableTo: string;
|
|
164
|
-
columnsTo: string[];
|
|
165
|
-
onUpdate?: string | undefined;
|
|
166
|
-
onDelete?: string | undefined;
|
|
167
|
-
}>;
|
|
168
|
-
compositePrimaryKeys: Record<string, {
|
|
169
|
-
name: string;
|
|
170
|
-
columns: string[];
|
|
171
|
-
}>;
|
|
172
|
-
uniqueConstraints: Record<string, {
|
|
173
|
-
name: string;
|
|
174
|
-
columns: string[];
|
|
175
|
-
}>;
|
|
176
|
-
}>;
|
|
177
|
-
id: string;
|
|
178
|
-
prevId: string;
|
|
179
|
-
version: "5";
|
|
180
|
-
dialect: "mysql";
|
|
181
|
-
_meta: {
|
|
182
|
-
columns: Record<string, string>;
|
|
183
|
-
tables: Record<string, string>;
|
|
184
|
-
};
|
|
185
|
-
internal?: {
|
|
186
|
-
tables: Record<string, {
|
|
187
|
-
columns: Record<string, {
|
|
188
|
-
isDefaultAnExpression?: boolean | undefined;
|
|
189
|
-
} | undefined>;
|
|
190
|
-
} | undefined>;
|
|
191
|
-
} | undefined;
|
|
192
|
-
};
|
|
193
|
-
}>;
|
|
194
|
-
export declare const prepareAndMigrateMysql: (config: GenerateConfig) => Promise<void>;
|
|
195
|
-
export declare const prepareAndMigrateSqlite: (config: GenerateConfig) => Promise<void>;
|
|
196
|
-
export declare const prepareSQLitePush: (schemaPath: string | string[], snapshot: SQLiteSchema) => Promise<{
|
|
197
|
-
sqlStatements: string[];
|
|
198
|
-
statements: import("../../jsonStatements").JsonStatement[];
|
|
199
|
-
squashedPrev: {
|
|
200
|
-
tables: Record<string, {
|
|
201
|
-
name: string;
|
|
202
|
-
columns: Record<string, {
|
|
203
|
-
name: string;
|
|
204
|
-
type: string;
|
|
205
|
-
primaryKey: boolean;
|
|
206
|
-
notNull: boolean;
|
|
207
|
-
default?: any;
|
|
208
|
-
autoincrement?: boolean | undefined;
|
|
209
|
-
}>;
|
|
210
|
-
indexes: Record<string, string>;
|
|
211
|
-
foreignKeys: Record<string, string>;
|
|
212
|
-
compositePrimaryKeys: Record<string, string>;
|
|
213
|
-
uniqueConstraints: Record<string, string>;
|
|
214
|
-
}>;
|
|
215
|
-
version: "5";
|
|
216
|
-
dialect: "sqlite";
|
|
217
|
-
enums?: any;
|
|
218
|
-
};
|
|
219
|
-
squashedCur: {
|
|
220
|
-
tables: Record<string, {
|
|
221
|
-
name: string;
|
|
222
|
-
columns: Record<string, {
|
|
223
|
-
name: string;
|
|
224
|
-
type: string;
|
|
225
|
-
primaryKey: boolean;
|
|
226
|
-
notNull: boolean;
|
|
227
|
-
default?: any;
|
|
228
|
-
autoincrement?: boolean | undefined;
|
|
229
|
-
}>;
|
|
230
|
-
indexes: Record<string, string>;
|
|
231
|
-
foreignKeys: Record<string, string>;
|
|
232
|
-
compositePrimaryKeys: Record<string, string>;
|
|
233
|
-
uniqueConstraints: Record<string, string>;
|
|
234
|
-
}>;
|
|
235
|
-
version: "5";
|
|
236
|
-
dialect: "sqlite";
|
|
237
|
-
enums?: any;
|
|
238
|
-
};
|
|
239
|
-
meta: {
|
|
240
|
-
schemas: {};
|
|
241
|
-
tables: {};
|
|
242
|
-
columns: {};
|
|
243
|
-
} | undefined;
|
|
244
|
-
}>;
|
|
245
|
-
export declare const promptColumnsConflicts: <T extends Named>(tableName: string, newColumns: T[], missingColumns: T[]) => Promise<{
|
|
246
|
-
created: T[];
|
|
247
|
-
renamed: {
|
|
248
|
-
from: T;
|
|
249
|
-
to: T;
|
|
250
|
-
}[];
|
|
251
|
-
deleted: T[];
|
|
252
|
-
}>;
|
|
253
|
-
export declare const promptNamedWithSchemasConflict: <T extends NamedWithSchema>(newItems: T[], missingItems: T[], entity: "table" | "enum") => Promise<{
|
|
254
|
-
created: T[];
|
|
255
|
-
renamed: {
|
|
256
|
-
from: T;
|
|
257
|
-
to: T;
|
|
258
|
-
}[];
|
|
259
|
-
moved: {
|
|
260
|
-
name: string;
|
|
261
|
-
schemaFrom: string;
|
|
262
|
-
schemaTo: string;
|
|
263
|
-
}[];
|
|
264
|
-
deleted: T[];
|
|
265
|
-
}>;
|
|
266
|
-
export declare const promptSchemasConflict: <T extends Named>(newSchemas: T[], missingSchemas: T[]) => Promise<{
|
|
267
|
-
created: T[];
|
|
268
|
-
renamed: {
|
|
269
|
-
from: T;
|
|
270
|
-
to: T;
|
|
271
|
-
}[];
|
|
272
|
-
deleted: T[];
|
|
273
|
-
}>;
|
|
274
|
-
export declare const BREAKPOINT = "--> statement-breakpoint\n";
|
|
275
|
-
export declare const writeResult: ({ cur, sqlStatements, journal, _meta, outFolder, breakpoints, name, bundle, type, }: {
|
|
276
|
-
cur: CommonSchema;
|
|
277
|
-
sqlStatements: string[];
|
|
278
|
-
journal: Journal;
|
|
279
|
-
_meta?: any;
|
|
280
|
-
outFolder: string;
|
|
281
|
-
breakpoints: boolean;
|
|
282
|
-
name?: string;
|
|
283
|
-
bundle?: boolean;
|
|
284
|
-
type?: "introspect" | "custom" | "none";
|
|
285
|
-
}) => void;
|
|
286
|
-
export declare const embeddedMigrations: (journal: Journal) => string;
|
|
287
|
-
export declare const prepareSnapshotFolderName: () => string;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import type { DB } from "../../utils";
|
|
2
|
-
export declare const mysqlPushIntrospect: (db: DB, databaseName: string, filters: string[]) => Promise<{
|
|
3
|
-
schema: {
|
|
4
|
-
tables: Record<string, {
|
|
5
|
-
name: string;
|
|
6
|
-
columns: Record<string, {
|
|
7
|
-
name: string;
|
|
8
|
-
type: string;
|
|
9
|
-
primaryKey: boolean;
|
|
10
|
-
notNull: boolean;
|
|
11
|
-
default?: any;
|
|
12
|
-
onUpdate?: any;
|
|
13
|
-
autoincrement?: boolean | undefined;
|
|
14
|
-
}>;
|
|
15
|
-
indexes: Record<string, {
|
|
16
|
-
name: string;
|
|
17
|
-
columns: string[];
|
|
18
|
-
isUnique: boolean;
|
|
19
|
-
using?: "btree" | "hash" | undefined;
|
|
20
|
-
algorithm?: "default" | "inplace" | "copy" | undefined;
|
|
21
|
-
lock?: "default" | "none" | "shared" | "exclusive" | undefined;
|
|
22
|
-
}>;
|
|
23
|
-
foreignKeys: Record<string, {
|
|
24
|
-
name: string;
|
|
25
|
-
tableFrom: string;
|
|
26
|
-
columnsFrom: string[];
|
|
27
|
-
tableTo: string;
|
|
28
|
-
columnsTo: string[];
|
|
29
|
-
onUpdate?: string | undefined;
|
|
30
|
-
onDelete?: string | undefined;
|
|
31
|
-
}>;
|
|
32
|
-
compositePrimaryKeys: Record<string, {
|
|
33
|
-
name: string;
|
|
34
|
-
columns: string[];
|
|
35
|
-
}>;
|
|
36
|
-
uniqueConstraints: Record<string, {
|
|
37
|
-
name: string;
|
|
38
|
-
columns: string[];
|
|
39
|
-
}>;
|
|
40
|
-
}>;
|
|
41
|
-
id: string;
|
|
42
|
-
prevId: string;
|
|
43
|
-
version: "5";
|
|
44
|
-
dialect: "mysql";
|
|
45
|
-
_meta: {
|
|
46
|
-
columns: Record<string, string>;
|
|
47
|
-
tables: Record<string, string>;
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
}>;
|