gg-mysql-connector 1.0.85 → 1.0.88

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.
@@ -49,7 +49,7 @@ class MyDBMigrator {
49
49
  const sql = `SHOW INDEX FROM ${tableName} WHERE Non_unique = 0 AND Key_name like "${compositeUniqueName}"`;
50
50
  const data = (await this.MyDB.query(sql));
51
51
  console.log("sql", sql);
52
- console.log("isCompositeUniqueColumnExist", data.length);
52
+ console.log("isCompositeUniqueColumnExist", data.length, data);
53
53
  return data.length ? true : false;
54
54
  }
55
55
  async alterForeignKey(tableName, col) {
@@ -71,7 +71,7 @@ class MyDBMigrator {
71
71
  }
72
72
  async alterUniqueColumnCombination(tableName, uniqueColumnCombination) {
73
73
  if (uniqueColumnCombination === null || uniqueColumnCombination === void 0 ? void 0 : uniqueColumnCombination.length) {
74
- uniqueColumnCombination.forEach(async (row) => {
74
+ for (let row of uniqueColumnCombination) {
75
75
  const isCompositeUniqueNameExist = await this.isCompositeUniqueColumnExist(tableName, row);
76
76
  // check is exist, then drop it first
77
77
  if (isCompositeUniqueNameExist) {
@@ -80,7 +80,7 @@ class MyDBMigrator {
80
80
  const compositeUniqueName = this.getCompositeUniqueName(row);
81
81
  const temp = row.columnName.join(",");
82
82
  await this.MyDB.query(`ALTER TABLE ${tableName} ADD UNIQUE KEY ${compositeUniqueName} (${temp})`);
83
- });
83
+ }
84
84
  }
85
85
  }
86
86
  async alterDataType(tableName, col) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gg-mysql-connector",
3
- "version": "1.0.85",
3
+ "version": "1.0.88",
4
4
  "description": "",
5
5
  "main": "dist/src/index.js",
6
6
  "scripts": {
@@ -79,7 +79,7 @@ export default class MyDBMigrator {
79
79
  const sql = `SHOW INDEX FROM ${tableName} WHERE Non_unique = 0 AND Key_name like "${compositeUniqueName}"`
80
80
  const data = (await this.MyDB.query(sql)) as any[]
81
81
  console.log("sql", sql)
82
- console.log("isCompositeUniqueColumnExist", data.length)
82
+ console.log("isCompositeUniqueColumnExist", data.length, data)
83
83
  return data.length ? true : false
84
84
  }
85
85
 
@@ -111,7 +111,7 @@ export default class MyDBMigrator {
111
111
  uniqueColumnCombination: MyModel["compoisteUniqueColumn"]
112
112
  ) {
113
113
  if (uniqueColumnCombination?.length) {
114
- uniqueColumnCombination.forEach(async (row) => {
114
+ for (let row of uniqueColumnCombination) {
115
115
  const isCompositeUniqueNameExist =
116
116
  await this.isCompositeUniqueColumnExist(tableName, row)
117
117
  // check is exist, then drop it first
@@ -127,7 +127,7 @@ export default class MyDBMigrator {
127
127
  await this.MyDB.query(
128
128
  `ALTER TABLE ${tableName} ADD UNIQUE KEY ${compositeUniqueName} (${temp})`
129
129
  )
130
- })
130
+ }
131
131
  }
132
132
  }
133
133