drizzle-kit 0.28.1 → 0.29.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.
- package/api.d.mts +347 -4
- package/api.d.ts +347 -4
- package/api.js +8682 -2972
- package/api.mjs +8679 -2972
- package/bin.cjs +47563 -44177
- package/{index-BfiZoTqG.d.mts → index-Z-1TKnbX.d.mts} +22 -7
- package/{index-BfiZoTqG.d.ts → index-Z-1TKnbX.d.ts} +22 -7
- package/index.d.mts +1 -1
- package/index.d.ts +1 -1
- package/package.json +2 -1
- package/utils.js +207 -96
- package/utils.mjs +207 -96
package/utils.mjs
CHANGED
@@ -876,30 +876,30 @@ var supports_color_default = supportsColor;
|
|
876
876
|
|
877
877
|
// ../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/utilities.js
|
878
878
|
function stringReplaceAll(string, substring, replacer) {
|
879
|
-
let
|
880
|
-
if (
|
879
|
+
let index5 = string.indexOf(substring);
|
880
|
+
if (index5 === -1) {
|
881
881
|
return string;
|
882
882
|
}
|
883
883
|
const substringLength = substring.length;
|
884
884
|
let endIndex = 0;
|
885
885
|
let returnValue = "";
|
886
886
|
do {
|
887
|
-
returnValue += string.slice(endIndex,
|
888
|
-
endIndex =
|
889
|
-
|
890
|
-
} while (
|
887
|
+
returnValue += string.slice(endIndex, index5) + substring + replacer;
|
888
|
+
endIndex = index5 + substringLength;
|
889
|
+
index5 = string.indexOf(substring, endIndex);
|
890
|
+
} while (index5 !== -1);
|
891
891
|
returnValue += string.slice(endIndex);
|
892
892
|
return returnValue;
|
893
893
|
}
|
894
|
-
function stringEncaseCRLFWithFirstIndex(string, prefix, postfix,
|
894
|
+
function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index5) {
|
895
895
|
let endIndex = 0;
|
896
896
|
let returnValue = "";
|
897
897
|
do {
|
898
|
-
const gotCR = string[
|
899
|
-
returnValue += string.slice(endIndex, gotCR ?
|
900
|
-
endIndex =
|
901
|
-
|
902
|
-
} while (
|
898
|
+
const gotCR = string[index5 - 1] === "\r";
|
899
|
+
returnValue += string.slice(endIndex, gotCR ? index5 - 1 : index5) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
|
900
|
+
endIndex = index5 + 1;
|
901
|
+
index5 = string.indexOf("\n", endIndex);
|
902
|
+
} while (index5 !== -1);
|
903
903
|
returnValue += string.slice(endIndex);
|
904
904
|
return returnValue;
|
905
905
|
}
|
@@ -3152,9 +3152,9 @@ var ZodArray = class _ZodArray extends ZodType {
|
|
3152
3152
|
return this.min(1, message);
|
3153
3153
|
}
|
3154
3154
|
};
|
3155
|
-
ZodArray.create = (
|
3155
|
+
ZodArray.create = (schema4, params) => {
|
3156
3156
|
return new ZodArray({
|
3157
|
-
type:
|
3157
|
+
type: schema4,
|
3158
3158
|
minLength: null,
|
3159
3159
|
maxLength: null,
|
3160
3160
|
exactLength: null,
|
@@ -3162,30 +3162,30 @@ ZodArray.create = (schema3, params) => {
|
|
3162
3162
|
...processCreateParams(params)
|
3163
3163
|
});
|
3164
3164
|
};
|
3165
|
-
function deepPartialify(
|
3166
|
-
if (
|
3165
|
+
function deepPartialify(schema4) {
|
3166
|
+
if (schema4 instanceof ZodObject) {
|
3167
3167
|
const newShape = {};
|
3168
|
-
for (const key in
|
3169
|
-
const fieldSchema =
|
3168
|
+
for (const key in schema4.shape) {
|
3169
|
+
const fieldSchema = schema4.shape[key];
|
3170
3170
|
newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));
|
3171
3171
|
}
|
3172
3172
|
return new ZodObject({
|
3173
|
-
...
|
3173
|
+
...schema4._def,
|
3174
3174
|
shape: () => newShape
|
3175
3175
|
});
|
3176
|
-
} else if (
|
3176
|
+
} else if (schema4 instanceof ZodArray) {
|
3177
3177
|
return new ZodArray({
|
3178
|
-
...
|
3179
|
-
type: deepPartialify(
|
3178
|
+
...schema4._def,
|
3179
|
+
type: deepPartialify(schema4.element)
|
3180
3180
|
});
|
3181
|
-
} else if (
|
3182
|
-
return ZodOptional.create(deepPartialify(
|
3183
|
-
} else if (
|
3184
|
-
return ZodNullable.create(deepPartialify(
|
3185
|
-
} else if (
|
3186
|
-
return ZodTuple.create(
|
3181
|
+
} else if (schema4 instanceof ZodOptional) {
|
3182
|
+
return ZodOptional.create(deepPartialify(schema4.unwrap()));
|
3183
|
+
} else if (schema4 instanceof ZodNullable) {
|
3184
|
+
return ZodNullable.create(deepPartialify(schema4.unwrap()));
|
3185
|
+
} else if (schema4 instanceof ZodTuple) {
|
3186
|
+
return ZodTuple.create(schema4.items.map((item) => deepPartialify(item)));
|
3187
3187
|
} else {
|
3188
|
-
return
|
3188
|
+
return schema4;
|
3189
3189
|
}
|
3190
3190
|
}
|
3191
3191
|
var ZodObject = class _ZodObject extends ZodType {
|
@@ -3402,8 +3402,8 @@ var ZodObject = class _ZodObject extends ZodType {
|
|
3402
3402
|
// }) as any;
|
3403
3403
|
// return merged;
|
3404
3404
|
// }
|
3405
|
-
setKey(key,
|
3406
|
-
return this.augment({ [key]:
|
3405
|
+
setKey(key, schema4) {
|
3406
|
+
return this.augment({ [key]: schema4 });
|
3407
3407
|
}
|
3408
3408
|
// merge<Incoming extends AnyZodObject>(
|
3409
3409
|
// merging: Incoming
|
@@ -3426,10 +3426,10 @@ var ZodObject = class _ZodObject extends ZodType {
|
|
3426
3426
|
// }) as any;
|
3427
3427
|
// return merged;
|
3428
3428
|
// }
|
3429
|
-
catchall(
|
3429
|
+
catchall(index5) {
|
3430
3430
|
return new _ZodObject({
|
3431
3431
|
...this._def,
|
3432
|
-
catchall:
|
3432
|
+
catchall: index5
|
3433
3433
|
});
|
3434
3434
|
}
|
3435
3435
|
pick(mask) {
|
@@ -3747,9 +3747,9 @@ function mergeValues(a, b) {
|
|
3747
3747
|
return { valid: false };
|
3748
3748
|
}
|
3749
3749
|
const newArray = [];
|
3750
|
-
for (let
|
3751
|
-
const itemA = a[
|
3752
|
-
const itemB = b[
|
3750
|
+
for (let index5 = 0; index5 < a.length; index5++) {
|
3751
|
+
const itemA = a[index5];
|
3752
|
+
const itemB = b[index5];
|
3753
3753
|
const sharedValue = mergeValues(itemA, itemB);
|
3754
3754
|
if (!sharedValue.valid) {
|
3755
3755
|
return { valid: false };
|
@@ -3849,10 +3849,10 @@ var ZodTuple = class _ZodTuple extends ZodType {
|
|
3849
3849
|
status.dirty();
|
3850
3850
|
}
|
3851
3851
|
const items = [...ctx.data].map((item, itemIndex) => {
|
3852
|
-
const
|
3853
|
-
if (!
|
3852
|
+
const schema4 = this._def.items[itemIndex] || this._def.rest;
|
3853
|
+
if (!schema4)
|
3854
3854
|
return null;
|
3855
|
-
return
|
3855
|
+
return schema4._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));
|
3856
3856
|
}).filter((x) => !!x);
|
3857
3857
|
if (ctx.common.async) {
|
3858
3858
|
return Promise.all(items).then((results) => {
|
@@ -3955,10 +3955,10 @@ var ZodMap = class extends ZodType {
|
|
3955
3955
|
}
|
3956
3956
|
const keyType = this._def.keyType;
|
3957
3957
|
const valueType = this._def.valueType;
|
3958
|
-
const pairs = [...ctx.data.entries()].map(([key, value],
|
3958
|
+
const pairs = [...ctx.data.entries()].map(([key, value], index5) => {
|
3959
3959
|
return {
|
3960
|
-
key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [
|
3961
|
-
value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [
|
3960
|
+
key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index5, "key"])),
|
3961
|
+
value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index5, "value"]))
|
3962
3962
|
};
|
3963
3963
|
});
|
3964
3964
|
if (ctx.common.async) {
|
@@ -4386,9 +4386,9 @@ var ZodPromise = class extends ZodType {
|
|
4386
4386
|
}));
|
4387
4387
|
}
|
4388
4388
|
};
|
4389
|
-
ZodPromise.create = (
|
4389
|
+
ZodPromise.create = (schema4, params) => {
|
4390
4390
|
return new ZodPromise({
|
4391
|
-
type:
|
4391
|
+
type: schema4,
|
4392
4392
|
typeName: ZodFirstPartyTypeKind.ZodPromise,
|
4393
4393
|
...processCreateParams(params)
|
4394
4394
|
});
|
@@ -4513,17 +4513,17 @@ var ZodEffects = class extends ZodType {
|
|
4513
4513
|
util.assertNever(effect);
|
4514
4514
|
}
|
4515
4515
|
};
|
4516
|
-
ZodEffects.create = (
|
4516
|
+
ZodEffects.create = (schema4, effect, params) => {
|
4517
4517
|
return new ZodEffects({
|
4518
|
-
schema:
|
4518
|
+
schema: schema4,
|
4519
4519
|
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
4520
4520
|
effect,
|
4521
4521
|
...processCreateParams(params)
|
4522
4522
|
});
|
4523
4523
|
};
|
4524
|
-
ZodEffects.createWithPreprocess = (preprocess,
|
4524
|
+
ZodEffects.createWithPreprocess = (preprocess, schema4, params) => {
|
4525
4525
|
return new ZodEffects({
|
4526
|
-
schema:
|
4526
|
+
schema: schema4,
|
4527
4527
|
effect: { type: "preprocess", transform: preprocess },
|
4528
4528
|
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
4529
4529
|
...processCreateParams(params)
|
@@ -5497,8 +5497,117 @@ var dryPg = pgSchema.parse({
|
|
5497
5497
|
}
|
5498
5498
|
});
|
5499
5499
|
|
5500
|
-
// src/serializer/
|
5500
|
+
// src/serializer/singlestoreSchema.ts
|
5501
5501
|
var index3 = objectType({
|
5502
|
+
name: stringType(),
|
5503
|
+
columns: stringType().array(),
|
5504
|
+
isUnique: booleanType(),
|
5505
|
+
using: enumType(["btree", "hash"]).optional(),
|
5506
|
+
algorithm: enumType(["default", "inplace", "copy"]).optional(),
|
5507
|
+
lock: enumType(["default", "none", "shared", "exclusive"]).optional()
|
5508
|
+
}).strict();
|
5509
|
+
var column3 = objectType({
|
5510
|
+
name: stringType(),
|
5511
|
+
type: stringType(),
|
5512
|
+
primaryKey: booleanType(),
|
5513
|
+
notNull: booleanType(),
|
5514
|
+
autoincrement: booleanType().optional(),
|
5515
|
+
default: anyType().optional(),
|
5516
|
+
onUpdate: anyType().optional(),
|
5517
|
+
generated: objectType({
|
5518
|
+
type: enumType(["stored", "virtual"]),
|
5519
|
+
as: stringType()
|
5520
|
+
}).optional()
|
5521
|
+
}).strict();
|
5522
|
+
var compositePK3 = objectType({
|
5523
|
+
name: stringType(),
|
5524
|
+
columns: stringType().array()
|
5525
|
+
}).strict();
|
5526
|
+
var uniqueConstraint3 = objectType({
|
5527
|
+
name: stringType(),
|
5528
|
+
columns: stringType().array()
|
5529
|
+
}).strict();
|
5530
|
+
var table3 = objectType({
|
5531
|
+
name: stringType(),
|
5532
|
+
columns: recordType(stringType(), column3),
|
5533
|
+
indexes: recordType(stringType(), index3),
|
5534
|
+
compositePrimaryKeys: recordType(stringType(), compositePK3),
|
5535
|
+
uniqueConstraints: recordType(stringType(), uniqueConstraint3).default({})
|
5536
|
+
}).strict();
|
5537
|
+
var viewMeta2 = objectType({
|
5538
|
+
algorithm: enumType(["undefined", "merge", "temptable"]),
|
5539
|
+
sqlSecurity: enumType(["definer", "invoker"]),
|
5540
|
+
withCheckOption: enumType(["local", "cascaded"]).optional()
|
5541
|
+
}).strict();
|
5542
|
+
var kitInternals3 = objectType({
|
5543
|
+
tables: recordType(
|
5544
|
+
stringType(),
|
5545
|
+
objectType({
|
5546
|
+
columns: recordType(
|
5547
|
+
stringType(),
|
5548
|
+
objectType({ isDefaultAnExpression: booleanType().optional() }).optional()
|
5549
|
+
)
|
5550
|
+
}).optional()
|
5551
|
+
).optional(),
|
5552
|
+
indexes: recordType(
|
5553
|
+
stringType(),
|
5554
|
+
objectType({
|
5555
|
+
columns: recordType(
|
5556
|
+
stringType(),
|
5557
|
+
objectType({ isExpression: booleanType().optional() }).optional()
|
5558
|
+
)
|
5559
|
+
}).optional()
|
5560
|
+
).optional()
|
5561
|
+
}).optional();
|
5562
|
+
var dialect2 = literalType("singlestore");
|
5563
|
+
var schemaHash3 = objectType({
|
5564
|
+
id: stringType(),
|
5565
|
+
prevId: stringType()
|
5566
|
+
});
|
5567
|
+
var schemaInternal2 = objectType({
|
5568
|
+
version: literalType("1"),
|
5569
|
+
dialect: dialect2,
|
5570
|
+
tables: recordType(stringType(), table3),
|
5571
|
+
/* views: record(string(), view).default({}), */
|
5572
|
+
_meta: objectType({
|
5573
|
+
tables: recordType(stringType(), stringType()),
|
5574
|
+
columns: recordType(stringType(), stringType())
|
5575
|
+
}),
|
5576
|
+
internal: kitInternals3
|
5577
|
+
}).strict();
|
5578
|
+
var schema2 = schemaInternal2.merge(schemaHash3);
|
5579
|
+
var tableSquashed3 = objectType({
|
5580
|
+
name: stringType(),
|
5581
|
+
columns: recordType(stringType(), column3),
|
5582
|
+
indexes: recordType(stringType(), stringType()),
|
5583
|
+
compositePrimaryKeys: recordType(stringType(), stringType()),
|
5584
|
+
uniqueConstraints: recordType(stringType(), stringType()).default({})
|
5585
|
+
}).strict();
|
5586
|
+
var schemaSquashed2 = objectType({
|
5587
|
+
version: literalType("1"),
|
5588
|
+
dialect: dialect2,
|
5589
|
+
tables: recordType(stringType(), tableSquashed3)
|
5590
|
+
/* views: record(string(), viewSquashed), */
|
5591
|
+
}).strict();
|
5592
|
+
var singlestoreSchema = schema2;
|
5593
|
+
var backwardCompatibleSingleStoreSchema = unionType([singlestoreSchema, schema2]);
|
5594
|
+
var drySingleStore = singlestoreSchema.parse({
|
5595
|
+
version: "1",
|
5596
|
+
dialect: "singlestore",
|
5597
|
+
id: originUUID,
|
5598
|
+
prevId: "",
|
5599
|
+
tables: {},
|
5600
|
+
schemas: {},
|
5601
|
+
/* views: {}, */
|
5602
|
+
_meta: {
|
5603
|
+
schemas: {},
|
5604
|
+
tables: {},
|
5605
|
+
columns: {}
|
5606
|
+
}
|
5607
|
+
});
|
5608
|
+
|
5609
|
+
// src/serializer/sqliteSchema.ts
|
5610
|
+
var index4 = objectType({
|
5502
5611
|
name: stringType(),
|
5503
5612
|
columns: stringType().array(),
|
5504
5613
|
where: stringType().optional(),
|
@@ -5513,11 +5622,11 @@ var fk3 = objectType({
|
|
5513
5622
|
onUpdate: stringType().optional(),
|
5514
5623
|
onDelete: stringType().optional()
|
5515
5624
|
}).strict();
|
5516
|
-
var
|
5625
|
+
var compositePK4 = objectType({
|
5517
5626
|
columns: stringType().array(),
|
5518
5627
|
name: stringType().optional()
|
5519
5628
|
}).strict();
|
5520
|
-
var
|
5629
|
+
var column4 = objectType({
|
5521
5630
|
name: stringType(),
|
5522
5631
|
type: stringType(),
|
5523
5632
|
primaryKey: booleanType(),
|
@@ -5531,11 +5640,11 @@ var column3 = objectType({
|
|
5531
5640
|
}).strict();
|
5532
5641
|
var tableV33 = objectType({
|
5533
5642
|
name: stringType(),
|
5534
|
-
columns: recordType(stringType(),
|
5535
|
-
indexes: recordType(stringType(),
|
5643
|
+
columns: recordType(stringType(), column4),
|
5644
|
+
indexes: recordType(stringType(), index4),
|
5536
5645
|
foreignKeys: recordType(stringType(), fk3)
|
5537
5646
|
}).strict();
|
5538
|
-
var
|
5647
|
+
var uniqueConstraint4 = objectType({
|
5539
5648
|
name: stringType(),
|
5540
5649
|
columns: stringType().array()
|
5541
5650
|
}).strict();
|
@@ -5543,50 +5652,50 @@ var checkConstraint3 = objectType({
|
|
5543
5652
|
name: stringType(),
|
5544
5653
|
value: stringType()
|
5545
5654
|
}).strict();
|
5546
|
-
var
|
5655
|
+
var table4 = objectType({
|
5547
5656
|
name: stringType(),
|
5548
|
-
columns: recordType(stringType(),
|
5549
|
-
indexes: recordType(stringType(),
|
5657
|
+
columns: recordType(stringType(), column4),
|
5658
|
+
indexes: recordType(stringType(), index4),
|
5550
5659
|
foreignKeys: recordType(stringType(), fk3),
|
5551
|
-
compositePrimaryKeys: recordType(stringType(),
|
5552
|
-
uniqueConstraints: recordType(stringType(),
|
5660
|
+
compositePrimaryKeys: recordType(stringType(), compositePK4),
|
5661
|
+
uniqueConstraints: recordType(stringType(), uniqueConstraint4).default({}),
|
5553
5662
|
checkConstraints: recordType(stringType(), checkConstraint3).default({})
|
5554
5663
|
}).strict();
|
5555
5664
|
var view3 = objectType({
|
5556
5665
|
name: stringType(),
|
5557
|
-
columns: recordType(stringType(),
|
5666
|
+
columns: recordType(stringType(), column4),
|
5558
5667
|
definition: stringType().optional(),
|
5559
5668
|
isExisting: booleanType()
|
5560
5669
|
}).strict();
|
5561
|
-
var
|
5562
|
-
var
|
5670
|
+
var dialect3 = enumType(["sqlite"]);
|
5671
|
+
var schemaHash4 = objectType({
|
5563
5672
|
id: stringType(),
|
5564
5673
|
prevId: stringType()
|
5565
5674
|
}).strict();
|
5566
5675
|
var schemaInternalV32 = objectType({
|
5567
5676
|
version: literalType("3"),
|
5568
|
-
dialect:
|
5677
|
+
dialect: dialect3,
|
5569
5678
|
tables: recordType(stringType(), tableV33),
|
5570
5679
|
enums: objectType({})
|
5571
5680
|
}).strict();
|
5572
5681
|
var schemaInternalV42 = objectType({
|
5573
5682
|
version: literalType("4"),
|
5574
|
-
dialect:
|
5575
|
-
tables: recordType(stringType(),
|
5683
|
+
dialect: dialect3,
|
5684
|
+
tables: recordType(stringType(), table4),
|
5576
5685
|
views: recordType(stringType(), view3).default({}),
|
5577
5686
|
enums: objectType({})
|
5578
5687
|
}).strict();
|
5579
5688
|
var schemaInternalV52 = objectType({
|
5580
5689
|
version: literalType("5"),
|
5581
|
-
dialect:
|
5582
|
-
tables: recordType(stringType(),
|
5690
|
+
dialect: dialect3,
|
5691
|
+
tables: recordType(stringType(), table4),
|
5583
5692
|
enums: objectType({}),
|
5584
5693
|
_meta: objectType({
|
5585
5694
|
tables: recordType(stringType(), stringType()),
|
5586
5695
|
columns: recordType(stringType(), stringType())
|
5587
5696
|
})
|
5588
5697
|
}).strict();
|
5589
|
-
var
|
5698
|
+
var kitInternals4 = objectType({
|
5590
5699
|
indexes: recordType(
|
5591
5700
|
stringType(),
|
5592
5701
|
objectType({
|
@@ -5598,39 +5707,39 @@ var kitInternals3 = objectType({
|
|
5598
5707
|
).optional()
|
5599
5708
|
}).optional();
|
5600
5709
|
var latestVersion = literalType("6");
|
5601
|
-
var
|
5710
|
+
var schemaInternal3 = objectType({
|
5602
5711
|
version: latestVersion,
|
5603
|
-
dialect:
|
5604
|
-
tables: recordType(stringType(),
|
5712
|
+
dialect: dialect3,
|
5713
|
+
tables: recordType(stringType(), table4),
|
5605
5714
|
views: recordType(stringType(), view3).default({}),
|
5606
5715
|
enums: objectType({}),
|
5607
5716
|
_meta: objectType({
|
5608
5717
|
tables: recordType(stringType(), stringType()),
|
5609
5718
|
columns: recordType(stringType(), stringType())
|
5610
5719
|
}),
|
5611
|
-
internal:
|
5720
|
+
internal: kitInternals4
|
5612
5721
|
}).strict();
|
5613
|
-
var schemaV32 = schemaInternalV32.merge(
|
5614
|
-
var schemaV42 = schemaInternalV42.merge(
|
5615
|
-
var schemaV52 = schemaInternalV52.merge(
|
5616
|
-
var
|
5617
|
-
var
|
5722
|
+
var schemaV32 = schemaInternalV32.merge(schemaHash4).strict();
|
5723
|
+
var schemaV42 = schemaInternalV42.merge(schemaHash4).strict();
|
5724
|
+
var schemaV52 = schemaInternalV52.merge(schemaHash4).strict();
|
5725
|
+
var schema3 = schemaInternal3.merge(schemaHash4).strict();
|
5726
|
+
var tableSquashed4 = objectType({
|
5618
5727
|
name: stringType(),
|
5619
|
-
columns: recordType(stringType(),
|
5728
|
+
columns: recordType(stringType(), column4),
|
5620
5729
|
indexes: recordType(stringType(), stringType()),
|
5621
5730
|
foreignKeys: recordType(stringType(), stringType()),
|
5622
5731
|
compositePrimaryKeys: recordType(stringType(), stringType()),
|
5623
5732
|
uniqueConstraints: recordType(stringType(), stringType()).default({}),
|
5624
5733
|
checkConstraints: recordType(stringType(), stringType()).default({})
|
5625
5734
|
}).strict();
|
5626
|
-
var
|
5735
|
+
var schemaSquashed3 = objectType({
|
5627
5736
|
version: latestVersion,
|
5628
|
-
dialect:
|
5629
|
-
tables: recordType(stringType(),
|
5737
|
+
dialect: dialect3,
|
5738
|
+
tables: recordType(stringType(), tableSquashed4),
|
5630
5739
|
views: recordType(stringType(), view3),
|
5631
5740
|
enums: anyType()
|
5632
5741
|
}).strict();
|
5633
|
-
var drySQLite =
|
5742
|
+
var drySQLite = schema3.parse({
|
5634
5743
|
version: "6",
|
5635
5744
|
dialect: "sqlite",
|
5636
5745
|
id: originUUID,
|
@@ -5644,7 +5753,7 @@ var drySQLite = schema2.parse({
|
|
5644
5753
|
}
|
5645
5754
|
});
|
5646
5755
|
var sqliteSchemaV5 = schemaV52;
|
5647
|
-
var backwardCompatibleSqliteSchema = unionType([sqliteSchemaV5,
|
5756
|
+
var backwardCompatibleSqliteSchema = unionType([sqliteSchemaV5, schema3]);
|
5648
5757
|
|
5649
5758
|
// src/utils.ts
|
5650
5759
|
var copy = (it) => {
|
@@ -5668,27 +5777,27 @@ var assertV1OutFolder = (out) => {
|
|
5668
5777
|
process.exit(1);
|
5669
5778
|
}
|
5670
5779
|
};
|
5671
|
-
var dryJournal = (
|
5780
|
+
var dryJournal = (dialect4) => {
|
5672
5781
|
return {
|
5673
5782
|
version: snapshotVersion,
|
5674
|
-
dialect:
|
5783
|
+
dialect: dialect4,
|
5675
5784
|
entries: []
|
5676
5785
|
};
|
5677
5786
|
};
|
5678
|
-
var prepareOutFolder = (out,
|
5787
|
+
var prepareOutFolder = (out, dialect4) => {
|
5679
5788
|
const meta = join(out, "meta");
|
5680
5789
|
const journalPath = join(meta, "_journal.json");
|
5681
5790
|
if (!existsSync(join(out, "meta"))) {
|
5682
5791
|
mkdirSync(meta, { recursive: true });
|
5683
|
-
writeFileSync(journalPath, JSON.stringify(dryJournal(
|
5792
|
+
writeFileSync(journalPath, JSON.stringify(dryJournal(dialect4)));
|
5684
5793
|
}
|
5685
5794
|
const journal = JSON.parse(readFileSync(journalPath).toString());
|
5686
5795
|
const snapshots = readdirSync(meta).filter((it) => !it.startsWith("_")).map((it) => join(meta, it));
|
5687
5796
|
snapshots.sort();
|
5688
5797
|
return { meta, snapshots, journal };
|
5689
5798
|
};
|
5690
|
-
var validatorForDialect = (
|
5691
|
-
switch (
|
5799
|
+
var validatorForDialect = (dialect4) => {
|
5800
|
+
switch (dialect4) {
|
5692
5801
|
case "postgresql":
|
5693
5802
|
return { validator: backwardCompatiblePgSchema, version: 7 };
|
5694
5803
|
case "sqlite":
|
@@ -5697,10 +5806,12 @@ var validatorForDialect = (dialect3) => {
|
|
5697
5806
|
return { validator: backwardCompatibleSqliteSchema, version: 6 };
|
5698
5807
|
case "mysql":
|
5699
5808
|
return { validator: backwardCompatibleMysqlSchema, version: 5 };
|
5809
|
+
case "singlestore":
|
5810
|
+
return { validator: backwardCompatibleSingleStoreSchema, version: 1 };
|
5700
5811
|
}
|
5701
5812
|
};
|
5702
|
-
var validateWithReport = (snapshots,
|
5703
|
-
const { validator, version } = validatorForDialect(
|
5813
|
+
var validateWithReport = (snapshots, dialect4) => {
|
5814
|
+
const { validator, version } = validatorForDialect(dialect4);
|
5704
5815
|
const result = snapshots.reduce(
|
5705
5816
|
(accum, it) => {
|
5706
5817
|
const raw = JSON.parse(readFileSync(`./${it}`).toString());
|
@@ -5741,9 +5852,9 @@ var validateWithReport = (snapshots, dialect3) => {
|
|
5741
5852
|
);
|
5742
5853
|
return result;
|
5743
5854
|
};
|
5744
|
-
var prepareMigrationFolder = (outFolder = "drizzle",
|
5745
|
-
const { snapshots, journal } = prepareOutFolder(outFolder,
|
5746
|
-
const report = validateWithReport(snapshots,
|
5855
|
+
var prepareMigrationFolder = (outFolder = "drizzle", dialect4) => {
|
5856
|
+
const { snapshots, journal } = prepareOutFolder(outFolder, dialect4);
|
5857
|
+
const report = validateWithReport(snapshots, dialect4);
|
5747
5858
|
if (report.nonLatest.length > 0) {
|
5748
5859
|
console.log(
|
5749
5860
|
report.nonLatest.map((it) => {
|
@@ -5806,8 +5917,8 @@ var tableRenameKey = (it) => {
|
|
5806
5917
|
const out = it.schema ? `"${it.schema}"."${it.name}"` : `"${it.name}"`;
|
5807
5918
|
return out;
|
5808
5919
|
};
|
5809
|
-
var columnRenameKey = (
|
5810
|
-
const out =
|
5920
|
+
var columnRenameKey = (table5, schema4, column5) => {
|
5921
|
+
const out = schema4 ? `"${schema4}"."${table5}"."${column5}"` : `"${table5}"."${column5}"`;
|
5811
5922
|
return out;
|
5812
5923
|
};
|
5813
5924
|
var kloudMeta = () => {
|