drizzle-seed 1.0.0-beta.2-278d7e6 → 1.0.0-beta.2-31baa2b

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 (77) hide show
  1. package/SeedService.d.cts +3 -12
  2. package/SeedService.d.mts +3 -12
  3. package/SeedService.d.ts +3 -12
  4. package/cockroach-core/index.d.cts +2 -2
  5. package/cockroach-core/index.d.mts +2 -2
  6. package/cockroach-core/index.d.ts +2 -2
  7. package/cockroach-core/selectGensForColumn.d.cts +3 -3
  8. package/cockroach-core/selectGensForColumn.d.mts +3 -3
  9. package/cockroach-core/selectGensForColumn.d.ts +3 -3
  10. package/common.d.cts +1 -1
  11. package/common.d.mts +1 -1
  12. package/common.d.ts +1 -1
  13. package/generators/GeneratorFuncs.d.cts +20 -950
  14. package/generators/GeneratorFuncs.d.mts +20 -950
  15. package/generators/GeneratorFuncs.d.ts +20 -950
  16. package/generators/Generators.d.cts +2 -29
  17. package/generators/Generators.d.mts +2 -29
  18. package/generators/Generators.d.ts +2 -29
  19. package/generators/apiVersion.d.cts +1 -1
  20. package/generators/apiVersion.d.mts +1 -1
  21. package/generators/apiVersion.d.ts +1 -1
  22. package/generators/utils.d.cts +0 -1
  23. package/generators/utils.d.mts +0 -1
  24. package/generators/utils.d.ts +0 -1
  25. package/generators/versioning/v2.d.cts +1 -1
  26. package/generators/versioning/v2.d.mts +1 -1
  27. package/generators/versioning/v2.d.ts +1 -1
  28. package/generators/versioning/v3.d.cts +1 -1
  29. package/generators/versioning/v3.d.mts +1 -1
  30. package/generators/versioning/v3.d.ts +1 -1
  31. package/index.cjs +26 -286
  32. package/index.cjs.map +1 -1
  33. package/index.d.cts +47 -68
  34. package/index.d.mts +47 -68
  35. package/index.d.ts +47 -68
  36. package/index.mjs +28 -288
  37. package/index.mjs.map +1 -1
  38. package/mssql-core/index.d.cts +1 -1
  39. package/mssql-core/index.d.mts +1 -1
  40. package/mssql-core/index.d.ts +1 -1
  41. package/mssql-core/selectGensForColumn.d.cts +2 -2
  42. package/mssql-core/selectGensForColumn.d.mts +2 -2
  43. package/mssql-core/selectGensForColumn.d.ts +2 -2
  44. package/mysql-core/index.d.cts +2 -2
  45. package/mysql-core/index.d.mts +2 -2
  46. package/mysql-core/index.d.ts +2 -2
  47. package/mysql-core/selectGensForColumn.d.cts +2 -2
  48. package/mysql-core/selectGensForColumn.d.mts +2 -2
  49. package/mysql-core/selectGensForColumn.d.ts +2 -2
  50. package/package.json +3 -5
  51. package/pg-core/index.d.cts +2 -2
  52. package/pg-core/index.d.mts +2 -2
  53. package/pg-core/index.d.ts +2 -2
  54. package/pg-core/selectGensForColumn.d.cts +3 -3
  55. package/pg-core/selectGensForColumn.d.mts +3 -3
  56. package/pg-core/selectGensForColumn.d.ts +3 -3
  57. package/singlestore-core/index.d.cts +2 -2
  58. package/singlestore-core/index.d.mts +2 -2
  59. package/singlestore-core/index.d.ts +2 -2
  60. package/singlestore-core/selectGensForColumn.d.cts +2 -2
  61. package/singlestore-core/selectGensForColumn.d.mts +2 -2
  62. package/singlestore-core/selectGensForColumn.d.ts +2 -2
  63. package/sqlite-core/index.d.cts +2 -2
  64. package/sqlite-core/index.d.mts +2 -2
  65. package/sqlite-core/index.d.ts +2 -2
  66. package/sqlite-core/selectGensForColumn.d.cts +2 -2
  67. package/sqlite-core/selectGensForColumn.d.mts +2 -2
  68. package/sqlite-core/selectGensForColumn.d.ts +2 -2
  69. package/types/seedService.d.cts +2 -2
  70. package/types/seedService.d.mts +2 -2
  71. package/types/seedService.d.ts +2 -2
  72. package/utils.d.cts +0 -4
  73. package/utils.d.mts +0 -4
  74. package/utils.d.ts +0 -4
  75. package/generators/versioning/v4.d.cts +0 -16
  76. package/generators/versioning/v4.d.mts +0 -16
  77. package/generators/versioning/v4.d.ts +0 -16
package/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { is, getTableName, getColumnTable, Column, entityKind, sql, eq } from 'drizzle-orm';
1
+ import { getTableName, is, getColumnTable, Column, entityKind, sql, eq } from 'drizzle-orm';
2
2
  import { MySqlTable, getTableConfig as getTableConfig$2, MySqlDatabase } from 'drizzle-orm/mysql-core';
3
- import { PgSmallInt, PgInteger, PgBigInt53, PgBigInt64, PgSmallSerial, PgSerial, PgBigSerial53, PgBigSerial64, PgTable, getTableConfig as getTableConfig$1, PgDatabase } from 'drizzle-orm/pg-core';
3
+ import { PgTable, getTableConfig as getTableConfig$1, PgDatabase } from 'drizzle-orm/pg-core';
4
4
  import { SQLiteTable, getTableConfig as getTableConfig$3, BaseSQLiteDatabase } from 'drizzle-orm/sqlite-core';
5
5
  import { MsSqlTable, getTableConfig as getTableConfig$5, MsSqlDatabase } from 'drizzle-orm/mssql-core';
6
6
  import { CockroachTable, getTableConfig as getTableConfig$4, CockroachDatabase } from 'drizzle-orm/cockroach-core';
@@ -40,17 +40,6 @@ const isRelationCyclic = (startRel) => {
40
40
  const equalSets = (set1, set2) => {
41
41
  return set1.size === set2.size && [...set1].every((si) => set2.has(si));
42
42
  };
43
- const intMax = (args) => args.reduce((m, e) => e > m ? e : m);
44
- const isPostgresColumnIntLike = (column) => {
45
- return is(column, PgSmallInt)
46
- || is(column, PgInteger)
47
- || is(column, PgBigInt53)
48
- || is(column, PgBigInt64)
49
- || is(column, PgSmallSerial)
50
- || is(column, PgSerial)
51
- || is(column, PgBigSerial53)
52
- || is(column, PgBigSerial64);
53
- };
54
43
 
55
44
  const getTableConfig = (table) => {
56
45
  if (is(table, PgTable))
@@ -131440,9 +131429,6 @@ const isObject = (value) => {
131440
131429
  return true;
131441
131430
  return false;
131442
131431
  };
131443
- const isValidDate = (date) => {
131444
- return !Number.isNaN(date.getTime());
131445
- };
131446
131432
  // const main = () => {
131447
131433
  // console.time('range');
131448
131434
  // const range = new OrderedBigintRange(BigInt(-10), BigInt(10), BigInt(1));
@@ -132161,20 +132147,13 @@ class GenerateDate extends AbstractGenerator {
132161
132147
  const rng = prand.xoroshiro128plus(seed);
132162
132148
  let { minDate, maxDate } = this.params;
132163
132149
  const anchorDate = new Date('2024-05-08');
132164
- // 4 years in milliseconds
132165
132150
  const deltaMilliseconds = 4 * 31536000000;
132166
132151
  if (typeof minDate === 'string') {
132167
132152
  minDate = new Date(minDate);
132168
132153
  }
132169
- if (typeof minDate === 'object' && !isValidDate(minDate)) {
132170
- throw new Error('Invalid Date was provided for the minDate parameter.');
132171
- }
132172
132154
  if (typeof maxDate === 'string') {
132173
132155
  maxDate = new Date(maxDate);
132174
132156
  }
132175
- if (typeof maxDate === 'object' && !isValidDate(maxDate)) {
132176
- throw new Error('Invalid Date was provided for the maxDate parameter.');
132177
- }
132178
132157
  if (minDate === undefined) {
132179
132158
  if (maxDate === undefined) {
132180
132159
  minDate = new Date(anchorDate.getTime() - deltaMilliseconds);
@@ -132187,9 +132166,6 @@ class GenerateDate extends AbstractGenerator {
132187
132166
  if (maxDate === undefined) {
132188
132167
  maxDate = new Date(minDate.getTime() + (2 * deltaMilliseconds));
132189
132168
  }
132190
- if (minDate > maxDate) {
132191
- throw new Error(`The minDate parameter must be less than or equal to the maxDate parameter.`);
132192
- }
132193
132169
  this.state = { rng, minDate, maxDate };
132194
132170
  }
132195
132171
  generate() {
@@ -132211,83 +132187,18 @@ class GenerateTime extends AbstractGenerator {
132211
132187
  init({ count, seed }) {
132212
132188
  super.init({ count, seed });
132213
132189
  const rng = prand.xoroshiro128plus(seed);
132214
- let { minTime, maxTime } = this.params;
132215
- if (minTime === undefined && maxTime === undefined) {
132216
- // TODO: maybe need to change in major version release
132217
- // This is required to ensure that this generator remains deterministic when used without minTime, maxTime parameters.
132218
- const oneDayInMilliseconds = 86400000;
132219
- minTime = new Date(new Date('2024-05-08T12:00:00.000Z').getTime() - oneDayInMilliseconds);
132220
- maxTime = new Date(new Date('2024-05-08T12:00:00.000Z').getTime() + oneDayInMilliseconds);
132221
- this.state = { rng, minTime, maxTime };
132222
- return;
132223
- }
132224
- if (minTime === undefined) {
132225
- if (maxTime === undefined) {
132226
- minTime = '00:00:00.000Z';
132227
- maxTime = '23:59:59.999Z';
132228
- }
132229
- else {
132230
- minTime = '00:00:00.000Z';
132231
- }
132232
- }
132233
- if (maxTime === undefined) {
132234
- maxTime = '23:59:59.999Z';
132235
- new Date().toISOString();
132236
- }
132237
- const anchorDate = new Date('2024-05-08');
132238
- const anchorDateString0 = anchorDate.toISOString().replace(/T\d{2}:\d{2}:\d{2}.\d{3}Z/, '');
132239
- if (typeof minTime === 'string') {
132240
- // const timeMatch0 = minTime.match(/^\d{2}:\d{2}:\d{2}.\d{1,3}Z?$/);
132241
- const timeMatch1 = minTime.match(/^\d{2}:\d{2}:\d{2}Z?$/);
132242
- const timeMatch2 = minTime.match(/^\d{2}:\d{2}Z?$/);
132243
- if (
132244
- // timeMatch0 === null
132245
- timeMatch1 === null
132246
- && timeMatch2 === null) {
132247
- throw new Error(`You're using the wrong format for the minTime parameter.`
132248
- + `\nPlease use one of these formats: 'HH:mm:ss', 'HH:mm' (with or without a trailing 'Z')`);
132249
- }
132250
- minTime = minTime.at(-1) === 'Z' ? minTime : minTime + 'Z';
132251
- minTime = new Date(anchorDate.toISOString().replace(/\d{2}:\d{2}:\d{2}.\d{3}Z/, minTime));
132252
- }
132253
- if (typeof minTime === 'object') {
132254
- if (!isValidDate(minTime)) {
132255
- throw new Error('Invalid Date was provided for the minTime parameter.');
132256
- }
132257
- minTime = new Date(minTime.toISOString().replace(/\d{4}-\d{2}-\d{2}/, anchorDateString0));
132258
- }
132259
- if (typeof maxTime === 'string') {
132260
- // const timeMatch0 = maxTime.match(/^\d{2}:\d{2}:\d{2}.\d{1,3}Z?$/);
132261
- const timeMatch1 = maxTime.match(/^\d{2}:\d{2}:\d{2}Z?$/);
132262
- const timeMatch2 = maxTime.match(/^\d{2}:\d{2}Z?$/);
132263
- if (
132264
- // timeMatch0 === null
132265
- timeMatch1 === null
132266
- && timeMatch2 === null) {
132267
- throw new Error(`You're using the wrong format for the maxTime parameter.`
132268
- + `\nPlease use one of these formats: 'HH:mm:ss', 'HH:mm' (with or without a trailing 'Z').`);
132269
- }
132270
- maxTime = maxTime.at(-1) === 'Z' ? maxTime : maxTime + 'Z';
132271
- maxTime = new Date(anchorDate.toISOString().replace(/\d{2}:\d{2}:\d{2}.\d{3}Z/, maxTime));
132272
- }
132273
- if (typeof maxTime === 'object') {
132274
- if (!isValidDate(maxTime)) {
132275
- throw new Error('Invalid Date was provided for the maxTime parameter.');
132276
- }
132277
- maxTime = new Date(maxTime.toISOString().replace(/\d{4}-\d{2}-\d{2}/, anchorDateString0));
132278
- }
132279
- if (minTime > maxTime) {
132280
- throw new Error(`The minTime parameter must be less than or equal to the maxTime parameter.`);
132281
- }
132282
- this.state = { rng, minTime, maxTime };
132190
+ this.state = { rng };
132283
132191
  }
132284
132192
  generate() {
132285
132193
  if (this.state === undefined) {
132286
132194
  throw new Error('state is not defined.');
132287
132195
  }
132196
+ const anchorDateTime = new Date('2024-05-08T12:00:00.000Z');
132197
+ const oneDayInMilliseconds = 86400000;
132198
+ let date = new Date();
132288
132199
  let milliseconds;
132289
- [milliseconds, this.state.rng] = prand.uniformIntDistribution(this.state.minTime.getTime(), this.state.maxTime.getTime(), this.state.rng);
132290
- const date = new Date(milliseconds);
132200
+ [milliseconds, this.state.rng] = prand.uniformIntDistribution(-oneDayInMilliseconds, oneDayInMilliseconds, this.state.rng);
132201
+ date = new Date(date.setTime(anchorDateTime.getTime() + milliseconds));
132291
132202
  return date.toISOString().replace(/(\d{4}-\d{2}-\d{2}T)|(\.\d{3}Z)/g, '');
132292
132203
  }
132293
132204
  }
@@ -132297,46 +132208,18 @@ class GenerateTimestamp extends AbstractGenerator {
132297
132208
  init({ count, seed }) {
132298
132209
  super.init({ count, seed });
132299
132210
  const rng = prand.xoroshiro128plus(seed);
132300
- let { minTimestamp, maxTimestamp } = this.params;
132301
- const anchorDate = new Date('2024-05-08');
132302
- // 2 years in milliseconds
132303
- const deltaMilliseconds = 2 * 31536000000;
132304
- if (typeof minTimestamp === 'string') {
132305
- minTimestamp = new Date(minTimestamp);
132306
- }
132307
- if (typeof minTimestamp === 'object' && !isValidDate(minTimestamp)) {
132308
- throw new Error('Invalid Date was provided for the minTimestamp parameter.');
132309
- }
132310
- if (typeof maxTimestamp === 'string') {
132311
- maxTimestamp = new Date(maxTimestamp);
132312
- }
132313
- if (typeof maxTimestamp === 'object' && !isValidDate(maxTimestamp)) {
132314
- throw new Error('Invalid Date was provided for the maxTimestamp parameter.');
132315
- }
132316
- if (minTimestamp === undefined) {
132317
- if (maxTimestamp === undefined) {
132318
- minTimestamp = new Date(anchorDate.getTime() - deltaMilliseconds);
132319
- maxTimestamp = new Date(anchorDate.getTime() + deltaMilliseconds);
132320
- }
132321
- else {
132322
- minTimestamp = new Date(maxTimestamp.getTime() - (2 * deltaMilliseconds));
132323
- }
132324
- }
132325
- if (maxTimestamp === undefined) {
132326
- maxTimestamp = new Date(minTimestamp.getTime() + (2 * deltaMilliseconds));
132327
- }
132328
- if (minTimestamp > maxTimestamp) {
132329
- throw new Error(`The minTimestamp parameter must be less than or equal to the maxTimestamp parameter.`);
132330
- }
132331
- this.state = { rng, minTimestamp, maxTimestamp };
132211
+ this.state = { rng };
132332
132212
  }
132333
132213
  generate() {
132334
132214
  if (this.state === undefined) {
132335
132215
  throw new Error('state is not defined.');
132336
132216
  }
132217
+ const anchorTimestamp = new Date('2024-05-08');
132218
+ const twoYearsInMilliseconds = 2 * 31536000000;
132219
+ let date = new Date();
132337
132220
  let milliseconds;
132338
- [milliseconds, this.state.rng] = prand.uniformIntDistribution(this.state.minTimestamp.getTime(), this.state.maxTimestamp.getTime(), this.state.rng);
132339
- const date = new Date(milliseconds);
132221
+ [milliseconds, this.state.rng] = prand.uniformIntDistribution(-twoYearsInMilliseconds, twoYearsInMilliseconds, this.state.rng);
132222
+ date = new Date(date.setTime(anchorTimestamp.getTime() + milliseconds));
132340
132223
  if (this.dataType === 'string') {
132341
132224
  return date
132342
132225
  .toISOString()
@@ -132352,46 +132235,18 @@ class GenerateDatetime extends AbstractGenerator {
132352
132235
  init({ count, seed }) {
132353
132236
  super.init({ count, seed });
132354
132237
  const rng = prand.xoroshiro128plus(seed);
132355
- let { minDatetime, maxDatetime } = this.params;
132356
- const anchorDate = new Date('2024-05-08');
132357
- // 2 years in milliseconds
132358
- const deltaMilliseconds = 2 * 31536000000;
132359
- if (typeof minDatetime === 'string') {
132360
- minDatetime = new Date(minDatetime);
132361
- }
132362
- if (typeof minDatetime === 'object' && !isValidDate(minDatetime)) {
132363
- throw new Error('Invalid Date was provided for the minDatetime parameter.');
132364
- }
132365
- if (typeof maxDatetime === 'string') {
132366
- maxDatetime = new Date(maxDatetime);
132367
- }
132368
- if (typeof maxDatetime === 'object' && !isValidDate(maxDatetime)) {
132369
- throw new Error('Invalid Date was provided for the maxDatetime parameter.');
132370
- }
132371
- if (minDatetime === undefined) {
132372
- if (maxDatetime === undefined) {
132373
- minDatetime = new Date(anchorDate.getTime() - deltaMilliseconds);
132374
- maxDatetime = new Date(anchorDate.getTime() + deltaMilliseconds);
132375
- }
132376
- else {
132377
- minDatetime = new Date(maxDatetime.getTime() - (2 * deltaMilliseconds));
132378
- }
132379
- }
132380
- if (maxDatetime === undefined) {
132381
- maxDatetime = new Date(minDatetime.getTime() + (2 * deltaMilliseconds));
132382
- }
132383
- if (minDatetime > maxDatetime) {
132384
- throw new Error(`The minDatetime parameter must be less than or equal to the maxDatetime parameter.`);
132385
- }
132386
- this.state = { rng, minDatetime, maxDatetime };
132238
+ this.state = { rng };
132387
132239
  }
132388
132240
  generate() {
132389
132241
  if (this.state === undefined) {
132390
132242
  throw new Error('state is not defined.');
132391
132243
  }
132244
+ const anchorDate = new Date('2024-05-08');
132245
+ const twoYearsInMilliseconds = 2 * 31536000000;
132246
+ let date = new Date();
132392
132247
  let milliseconds;
132393
- [milliseconds, this.state.rng] = prand.uniformIntDistribution(this.state.minDatetime.getTime(), this.state.maxDatetime.getTime(), this.state.rng);
132394
- const date = new Date(milliseconds);
132248
+ [milliseconds, this.state.rng] = prand.uniformIntDistribution(-twoYearsInMilliseconds, twoYearsInMilliseconds, this.state.rng);
132249
+ date = new Date(date.setTime(anchorDate.getTime() + milliseconds));
132395
132250
  if (this.dataType === 'string') {
132396
132251
  return date
132397
132252
  .toISOString()
@@ -134606,49 +134461,6 @@ class GenerateHashFromStringV3 extends AbstractGenerator {
134606
134461
  }
134607
134462
  }
134608
134463
 
134609
- /* eslint-disable drizzle-internal/require-entity-kind */
134610
- class GenerateUUIDV4 extends AbstractGenerator {
134611
- static entityKind = 'GenerateUUID';
134612
- static version = 4;
134613
- isGeneratorUnique = true;
134614
- maxUniqueCount = Number.POSITIVE_INFINITY;
134615
- state;
134616
- getMaxUniqueCount() {
134617
- return Number.POSITIVE_INFINITY;
134618
- }
134619
- init({ count, seed }) {
134620
- super.init({ count, seed });
134621
- const rng = prand.xoroshiro128plus(seed);
134622
- this.state = { rng };
134623
- }
134624
- generate() {
134625
- if (this.state === undefined) {
134626
- throw new Error('state is not defined.');
134627
- }
134628
- // TODO generate uuid using string generator
134629
- const stringChars = '1234567890abcdef';
134630
- let idx, currStr;
134631
- const strLength = 36;
134632
- // uuid v4
134633
- const uuidTemplate = '########-####-4###-N###-############';
134634
- currStr = '';
134635
- for (let i = 0; i < strLength; i++) {
134636
- [idx, this.state.rng] = prand.uniformIntDistribution(0, stringChars.length - 1, this.state.rng);
134637
- if (uuidTemplate[i] === '#') {
134638
- currStr += stringChars[idx];
134639
- continue;
134640
- }
134641
- // used this pr -> https://github.com/drizzle-team/drizzle-orm/pull/4503
134642
- if (uuidTemplate[i] === 'N') {
134643
- currStr += '89ab'[idx % 4];
134644
- continue;
134645
- }
134646
- currStr += uuidTemplate[i];
134647
- }
134648
- return currStr;
134649
- }
134650
- }
134651
-
134652
134464
  function createGenerator(generatorConstructor) {
134653
134465
  return (...args) => {
134654
134466
  let params = args[0];
@@ -134814,8 +134626,6 @@ const generatorsFuncs = {
134814
134626
  date: createGenerator(GenerateDate),
134815
134627
  /**
134816
134628
  * generates time in 24 hours style.
134817
- * @param minTime - lower border of range.
134818
- * @param maxTime - upper border of range.
134819
134629
  * @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
134820
134630
  *
134821
134631
  * @example
@@ -134823,7 +134633,7 @@ const generatorsFuncs = {
134823
134633
  * await seed(db, schema, { count: 1000 }).refine((funcs) => ({
134824
134634
  * users: {
134825
134635
  * columns: {
134826
- * birthTime: funcs.time({ minTime: "11:12:13.141", maxTime: "15:16:17.181" })
134636
+ * birthTime: funcs.time()
134827
134637
  * },
134828
134638
  * },
134829
134639
  * }));
@@ -134833,8 +134643,6 @@ const generatorsFuncs = {
134833
134643
  time: createGenerator(GenerateTime),
134834
134644
  /**
134835
134645
  * generates timestamps.
134836
- * @param minTimestamp - lower border of range.
134837
- * @param maxTimestamp - upper border of range.
134838
134646
  * @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
134839
134647
  *
134840
134648
  * @example
@@ -134842,7 +134650,7 @@ const generatorsFuncs = {
134842
134650
  * await seed(db, schema, { count: 1000 }).refine((funcs) => ({
134843
134651
  * orders: {
134844
134652
  * columns: {
134845
- * shippedDate: funcs.timestamp({ minTimestamp: "2025-03-07T11:12:13.141", maxTimestamp: "2025-03-08T15:16:17.181" })
134653
+ * shippedDate: funcs.timestamp()
134846
134654
  * },
134847
134655
  * },
134848
134656
  * }));
@@ -134852,8 +134660,6 @@ const generatorsFuncs = {
134852
134660
  timestamp: createGenerator(GenerateTimestamp),
134853
134661
  /**
134854
134662
  * generates datetime objects.
134855
- * @param minDatetime - lower border of range.
134856
- * @param maxDatetime - upper border of range.
134857
134663
  * @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
134858
134664
  *
134859
134665
  * @example
@@ -134861,7 +134667,7 @@ const generatorsFuncs = {
134861
134667
  * await seed(db, schema, { count: 1000 }).refine((funcs) => ({
134862
134668
  * orders: {
134863
134669
  * columns: {
134864
- * shippedDate: funcs.datetime({ minDatetime: "2025-03-07T11:12:13.141", maxDatetime: "2025-03-08T15:16:17.181" })
134670
+ * shippedDate: funcs.datetime()
134865
134671
  * },
134866
134672
  * },
134867
134673
  * }));
@@ -135446,16 +135252,13 @@ const generatorsFuncs = {
135446
135252
  */
135447
135253
  vector: createGenerator(GenerateVector),
135448
135254
  };
135449
- // so far, version changes don’t change generator parameters.
135255
+ // so far, version changes don’t affect generator parameters.
135450
135256
  const generatorsFuncsV2 = {
135451
135257
  ...generatorsFuncs,
135452
135258
  };
135453
135259
  ({
135454
135260
  ...generatorsFuncs,
135455
135261
  });
135456
- ({
135457
- ...generatorsFuncs,
135458
- });
135459
135262
  const generatorsMap = {
135460
135263
  GenerateHashFromString: [
135461
135264
  GenerateHashFromString,
@@ -135529,7 +135332,6 @@ const generatorsMap = {
135529
135332
  ],
135530
135333
  GenerateUUID: [
135531
135334
  GenerateUUID,
135532
- GenerateUUIDV4,
135533
135335
  ],
135534
135336
  GenerateFirstName: [
135535
135337
  GenerateFirstName,
@@ -135860,7 +135662,7 @@ const selectGeneratorForCockroachColumn = (table, col) => {
135860
135662
  return generator;
135861
135663
  };
135862
135664
 
135863
- const latestVersion = 4;
135665
+ const latestVersion = 3;
135864
135666
 
135865
135667
  const selectGeneratorForMssqlColumn = (table, col) => {
135866
135668
  const pickGenerator = (table, col) => {
@@ -136750,7 +136552,6 @@ class SeedService {
136750
136552
  };
136751
136553
  }
136752
136554
  }
136753
- // handling refinements (count, with)
136754
136555
  if (refinements !== undefined && refinements[table.name] !== undefined) {
136755
136556
  if (refinements[table.name].count !== undefined) {
136756
136557
  tablesPossibleGenerators[i].count = refinements[table.name].count;
@@ -136812,7 +136613,6 @@ class SeedService {
136812
136613
  wasDefinedBefore: false,
136813
136614
  wasRefined: false,
136814
136615
  };
136815
- // handling refinements (columnGenerator)
136816
136616
  if (refinements !== undefined
136817
136617
  && refinements[table.name] !== undefined
136818
136618
  && refinements[table.name].columns !== undefined
@@ -136825,7 +136625,7 @@ class SeedService {
136825
136625
  + `\nwhich will cause an error because the column has a not null constraint and no default value.`);
136826
136626
  }
136827
136627
  // Generating undefined as a value for a column and then inserting it via drizzle-orm
136828
- // will result in null of default value being inserted into that column.
136628
+ // will result in the value not being inserted into that column.
136829
136629
  columnPossibleGenerator.generator = new generatorsMap.GenerateDefault[0]({ defaultValue: undefined });
136830
136630
  columnPossibleGenerator.wasRefined = true;
136831
136631
  continue;
@@ -137163,8 +136963,7 @@ class SeedService {
137163
136963
  };
137164
136964
  }
137165
136965
  // get values to generate columns with foreign key
137166
- // if table posts contains foreign key to table users, then rel.table === 'posts' and rel.refTable === 'users',
137167
- // because table posts has reference to table users.
136966
+ // if table posts contains foreign key to table users, then rel.table === 'posts' and rel.refTable === 'users', because table posts has reference to table users.
137168
136967
  if (filteredRelations.length !== 0) {
137169
136968
  for (const rel of filteredRelations) {
137170
136969
  if (table.withFromTable[rel.refTable] !== undefined
@@ -137302,25 +137101,6 @@ class SeedService {
137302
137101
  // columnsGenerators[columnName] = uniqueGen;
137303
137102
  // }
137304
137103
  }
137305
- // sequence updates will only be performed for PostgreSQL, since MySQL and SQLite already update their sequences correctly on their own.
137306
- const columnsToUpdateSeq = new Map();
137307
- if (count > 0 && is(db, PgDatabase) && schema !== undefined && tableName !== undefined
137308
- && schema[tableName] !== undefined) {
137309
- const tableConfig = getTableConfig$1(schema[tableName]);
137310
- for (const column of tableConfig.columns) {
137311
- // TODO should I filter only primary key columns?
137312
- // should I filter column by dataType or by column drizzle type?
137313
- // column.dataType === 'number' || column.dataType === 'bigint'
137314
- if (isPostgresColumnIntLike(column)) {
137315
- columnsToUpdateSeq.set(column.name, {
137316
- schemaName: tableConfig.schema,
137317
- tableName: tableConfig.name,
137318
- columnName: column.name,
137319
- valueToUpdate: undefined,
137320
- });
137321
- }
137322
- }
137323
- }
137324
137104
  let maxParametersNumber;
137325
137105
  if (is(db, (PgDatabase))) {
137326
137106
  // @ts-ignore
@@ -137351,12 +137131,6 @@ class SeedService {
137351
137131
  for (const columnName of Object.keys(columnsGenerators)) {
137352
137132
  generatedValue = columnsGenerators[columnName].generate({ i, columnName });
137353
137133
  row[columnName] = generatedValue;
137354
- const colToUpdateSeq = columnsToUpdateSeq.get(columnName);
137355
- if (columnsToUpdateSeq.size !== 0 && colToUpdateSeq !== undefined) {
137356
- colToUpdateSeq.valueToUpdate = colToUpdateSeq?.valueToUpdate === undefined
137357
- ? generatedValue
137358
- : intMax([colToUpdateSeq.valueToUpdate, generatedValue]);
137359
- }
137360
137134
  }
137361
137135
  if ((insertDataInDb === true || updateDataInDb === true)
137362
137136
  && ((i + 1) % batchSize === 0 || i === count - 1)) {
@@ -137403,28 +137177,9 @@ class SeedService {
137403
137177
  }
137404
137178
  }
137405
137179
  }
137406
- const columnsToUpdateSeqFiltered = [...columnsToUpdateSeq.values()].filter((col) => col.valueToUpdate !== undefined);
137407
- if (i === count - 1
137408
- && columnsToUpdateSeqFiltered.length !== 0 && db !== undefined) {
137409
- for (const columnConfig of columnsToUpdateSeq.values()) {
137410
- if (columnConfig) {
137411
- await this.updateColumnSequence({ db, columnConfig });
137412
- }
137413
- }
137414
- }
137415
137180
  }
137416
137181
  return preserveData === true ? generatedValues : [];
137417
137182
  };
137418
- updateColumnSequence = async ({ db, columnConfig: { schemaName, tableName, columnName, valueToUpdate } }) => {
137419
- if (is(db, PgDatabase)) {
137420
- const fullTableName = schemaName ? `"${schemaName}"."${tableName}"` : `"${tableName}"`;
137421
- const rawQuery = `SELECT setval(pg_get_serial_sequence('${fullTableName}', '${columnName}'), ${(valueToUpdate ?? 'null').toString()}, true);`;
137422
- await db.execute(sql.raw(rawQuery));
137423
- }
137424
- // mysql updates auto_increment or serial column by itself
137425
- // sqlite updates autoincrement column by itself
137426
- return;
137427
- };
137428
137183
  insertInDb = async ({ generatedValues, db, schema, tableName, override, }) => {
137429
137184
  if (is(db, (PgDatabase))) {
137430
137185
  const query = db.insert(schema[tableName]);
@@ -138150,7 +137905,7 @@ async function seedForDrizzleStudio({ sqlDialect, drizzleStudioObject, drizzleSt
138150
137905
  * // seeding with count and seed specified
138151
137906
  * await seed(db, schema, { count: 100000, seed: 1 });
138152
137907
  *
138153
- * // seeding using refine
137908
+ * //seeding using refine
138154
137909
  * await seed(db, schema, { count: 1000 }).refine((funcs) => ({
138155
137910
  * users: {
138156
137911
  * columns: {
@@ -138171,17 +137926,6 @@ async function seedForDrizzleStudio({ sqlDialect, drizzleStudioObject, drizzleSt
138171
137926
  * },
138172
137927
  * }));
138173
137928
  *
138174
- * // seeding while ignoring column
138175
- * await seed(db, schema).refine((funcs) => ({
138176
- * users: {
138177
- * count: 5,
138178
- * columns: {
138179
- * name: funcs.fullName(),
138180
- * photo: false, // the photo column will not be seeded, allowing the database to use its default value.
138181
- * },
138182
- * },
138183
- * }));
138184
- *
138185
137929
  * ```
138186
137930
  */
138187
137931
  function seed(db, schema, options) {
@@ -138253,10 +137997,6 @@ const seedFunc = async (db, schema, options = {}, refinements) => {
138253
137997
  * @example
138254
137998
  * ```ts
138255
137999
  * await reset(db, schema);
138256
- *
138257
- * // Alternatively, you can provide an object containing your tables
138258
- * // as the `schema` parameter when calling `reset`.
138259
- * await reset(db, { users });
138260
138000
  * ```
138261
138001
  */
138262
138002
  async function reset(db, schema) {