drizzle-seed 0.3.2-61ab0d9 → 0.3.2-8e220c4

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/index.cjs CHANGED
@@ -134648,8 +134648,8 @@ class SeedService {
134648
134648
  // NUMBER(real, double, decimal, numeric)
134649
134649
  if (col.columnType === 'real'
134650
134650
  || col.columnType === 'double precision'
134651
- || col.columnType.match(/^decimal(\(\d+,? *\d*\))?$/) !== null
134652
- || col.columnType.match(/^numeric(\(\d+,? *\d*\))?$/) !== null) {
134651
+ || col.columnType.match(/^decimal(\(\d{1,6}(, ?-?\d{0,5})?\))?$/) !== null
134652
+ || col.columnType.match(/^numeric(\(\d{1,6}(, ?-?\d{0,5})?\))?$/) !== null) {
134653
134653
  if (col.typeParams.precision !== undefined) {
134654
134654
  const precision = col.typeParams.precision;
134655
134655
  const scale = col.typeParams.scale === undefined ? 0 : col.typeParams.scale;
@@ -134825,8 +134825,8 @@ class SeedService {
134825
134825
  if (col.columnType === 'real'
134826
134826
  || col.columnType === 'double'
134827
134827
  || col.columnType === 'float'
134828
- || col.columnType.match(/^decimal(\(\d+,? *\d*\))?$/) !== null
134829
- || col.columnType.match(/^numeric(\(\d+,? *\d*\))?$/) !== null) {
134828
+ || col.columnType.startsWith('decimal')
134829
+ || col.columnType.startsWith('numeric')) {
134830
134830
  if (col.typeParams.precision !== undefined) {
134831
134831
  const precision = col.typeParams.precision;
134832
134832
  const scale = col.typeParams.scale === undefined ? 0 : col.typeParams.scale;
@@ -134844,40 +134844,40 @@ class SeedService {
134844
134844
  // STRING
134845
134845
  if ((col.columnType === 'text'
134846
134846
  || col.columnType === 'blob'
134847
- || col.columnType.match(/^char(\(\d+\))?$/) !== null
134848
- || col.columnType.match(/^varchar(\(\d+\))?$/) !== null
134849
- || col.columnType.match(/^binary(\(\d+\))?$/) !== null
134850
- || col.columnType.match(/^varbinary(\(\d+\))?$/) !== null)
134847
+ || col.columnType.startsWith('char')
134848
+ || col.columnType.startsWith('varchar')
134849
+ || col.columnType.startsWith('binary')
134850
+ || col.columnType.startsWith('varbinary'))
134851
134851
  && table.primaryKeys.includes(col.name)) {
134852
134852
  const generator = new generatorsMap.GenerateUniqueString[0]();
134853
134853
  return generator;
134854
134854
  }
134855
134855
  if ((col.columnType === 'text'
134856
134856
  || col.columnType === 'blob'
134857
- || col.columnType.match(/^char(\(\d+\))?$/) !== null
134858
- || col.columnType.match(/^varchar(\(\d+\))?$/) !== null
134859
- || col.columnType.match(/^binary(\(\d+\))?$/) !== null
134860
- || col.columnType.match(/^varbinary(\(\d+\))?$/) !== null)
134857
+ || col.columnType.startsWith('char')
134858
+ || col.columnType.startsWith('varchar')
134859
+ || col.columnType.startsWith('binary')
134860
+ || col.columnType.startsWith('varbinary'))
134861
134861
  && col.name.toLowerCase().includes('name')) {
134862
134862
  const generator = new generatorsMap.GenerateFirstName[0]();
134863
134863
  return generator;
134864
134864
  }
134865
134865
  if ((col.columnType === 'text'
134866
134866
  || col.columnType === 'blob'
134867
- || col.columnType.match(/^char(\(\d+\))?$/) !== null
134868
- || col.columnType.match(/^varchar(\(\d+\))?$/) !== null
134869
- || col.columnType.match(/^binary(\(\d+\))?$/) !== null
134870
- || col.columnType.match(/^varbinary(\(\d+\))?$/) !== null)
134867
+ || col.columnType.startsWith('char')
134868
+ || col.columnType.startsWith('varchar')
134869
+ || col.columnType.startsWith('binary')
134870
+ || col.columnType.startsWith('varbinary'))
134871
134871
  && col.name.toLowerCase().includes('email')) {
134872
134872
  const generator = new generatorsMap.GenerateEmail[0]();
134873
134873
  return generator;
134874
134874
  }
134875
134875
  if (col.columnType === 'text'
134876
134876
  || col.columnType === 'blob'
134877
- || col.columnType.match(/^char(\(\d+\))?$/) !== null
134878
- || col.columnType.match(/^varchar(\(\d+\))?$/) !== null
134879
- || col.columnType.match(/^binary(\(\d+\))?$/) !== null
134880
- || col.columnType.match(/^varbinary(\(\d+\))?$/) !== null) {
134877
+ || col.columnType.startsWith('char')
134878
+ || col.columnType.startsWith('varchar')
134879
+ || col.columnType.startsWith('binary')
134880
+ || col.columnType.startsWith('varbinary')) {
134881
134881
  const generator = new generatorsMap.GenerateString[0]();
134882
134882
  return generator;
134883
134883
  }
@@ -134887,7 +134887,7 @@ class SeedService {
134887
134887
  return generator;
134888
134888
  }
134889
134889
  // DATE, TIME, TIMESTAMP, DATETIME, YEAR
134890
- if (col.columnType.match(/^datetime(\(\d\))?$/) !== null) {
134890
+ if (col.columnType.startsWith('datetime')) {
134891
134891
  const generator = new generatorsMap.GenerateDatetime[0]();
134892
134892
  return generator;
134893
134893
  }
@@ -134899,7 +134899,7 @@ class SeedService {
134899
134899
  const generator = new generatorsMap.GenerateTime[0]();
134900
134900
  return generator;
134901
134901
  }
134902
- if (col.columnType.match(/^timestamp(\(\d\))?$/) !== null) {
134902
+ if (col.columnType.startsWith('timestamp')) {
134903
134903
  const generator = new generatorsMap.GenerateTimestamp[0]();
134904
134904
  return generator;
134905
134905
  }
@@ -134952,8 +134952,8 @@ class SeedService {
134952
134952
  return generator;
134953
134953
  }
134954
134954
  // number section ------------------------------------------------------------------------------------
134955
- if (col.columnType.match(/^real(\(\d+,? *\d*\))?$/) !== null
134956
- || col.columnType.match(/^numeric(\(\d+,? *\d*\))?$/) !== null) {
134955
+ if (col.columnType.startsWith('real')
134956
+ || col.columnType.startsWith('numeric')) {
134957
134957
  if (col.typeParams.precision !== undefined) {
134958
134958
  const precision = col.typeParams.precision;
134959
134959
  const scale = col.typeParams.scale === undefined ? 0 : col.typeParams.scale;