gg-mysql-connector 1.0.49 → 1.0.53
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/dist/src/ModelGenerator/ModelGenerator.d.ts +1 -1
- package/dist/src/MyDBMigrator/MyDBMigrator.d.ts +1 -1
- package/dist/src/MyDBMigrator/MyDBMigrator.js +1 -5
- package/dist/src/myModel.d.ts +1 -1
- package/package.json +1 -1
- package/src/MyDBMigrator/MyDBMigrator.ts +2 -8
- package/src/myModel.ts +1 -1
|
@@ -25,7 +25,7 @@ export default class ModelGenerator {
|
|
|
25
25
|
getColumnFullList(tableName: string): Promise<mysql.RowDataPacket[]>;
|
|
26
26
|
private isTableNameExistInModel;
|
|
27
27
|
private isColumnExistInModel;
|
|
28
|
-
getPossibleColumnValue(model: MyModel[], tableName: string, columnName: string, columnType: string): false |
|
|
28
|
+
getPossibleColumnValue(model: MyModel[], tableName: string, columnName: string, columnType: string): false | string[] | undefined;
|
|
29
29
|
generateModelInterface(params: {
|
|
30
30
|
appName: string;
|
|
31
31
|
model: MyModel[];
|
|
@@ -17,7 +17,7 @@ export default class MyDBMigrator {
|
|
|
17
17
|
private checkIsColumnDataTypeChange;
|
|
18
18
|
alterUniqueKey(tableName: string, columnName: string, IS_UNIQUE: boolean | undefined): Promise<void>;
|
|
19
19
|
alterIndex(tableName: string, columnName: string, IS_INDEX: boolean | undefined): Promise<void>;
|
|
20
|
-
alterPossibleEnum(tableName: string, columnName: string, possibleValue?:
|
|
20
|
+
alterPossibleEnum(tableName: string, columnName: string, possibleValue?: string[]): Promise<null | undefined>;
|
|
21
21
|
migrateView(viewDirectory: string): Promise<0 | undefined>;
|
|
22
22
|
migrateView_v2(viewModel: MyViewModel[]): Promise<void>;
|
|
23
23
|
checkIsPrimaryKey(databaseName: string, tableName: string, columnName: string): Promise<boolean>;
|
|
@@ -119,15 +119,11 @@ class MyDBMigrator {
|
|
|
119
119
|
const data = this.onetimeLoadColumnContent.find((row) => row.COLUMN_NAME === columnName && row.TABLE_NAME === tableName);
|
|
120
120
|
if (data) {
|
|
121
121
|
let possibleValueString = possibleValue
|
|
122
|
-
.filter((row) => row !== null)
|
|
123
122
|
.map((row) => {
|
|
124
123
|
return `"${row}"`;
|
|
125
124
|
})
|
|
126
125
|
.join(", ");
|
|
127
|
-
|
|
128
|
-
? "NULL"
|
|
129
|
-
: "NOT NULL";
|
|
130
|
-
await this.MyDB.query(`ALTER TABLE ${tableName} MODIFY COLUMN ${columnName} ENUM(${possibleValueString}) ${nullString};`);
|
|
126
|
+
await this.MyDB.query(`ALTER TABLE ${tableName} MODIFY COLUMN ${columnName} ENUM(${possibleValueString}) NOT NULL;`);
|
|
131
127
|
}
|
|
132
128
|
}
|
|
133
129
|
async migrateView(viewDirectory) {
|
package/dist/src/myModel.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -189,7 +189,7 @@ export default class MyDBMigrator {
|
|
|
189
189
|
async alterPossibleEnum(
|
|
190
190
|
tableName: string,
|
|
191
191
|
columnName: string,
|
|
192
|
-
possibleValue?:
|
|
192
|
+
possibleValue?: string[]
|
|
193
193
|
) {
|
|
194
194
|
if (!possibleValue) return null
|
|
195
195
|
const data = this.onetimeLoadColumnContent.find(
|
|
@@ -197,19 +197,13 @@ export default class MyDBMigrator {
|
|
|
197
197
|
)
|
|
198
198
|
if (data) {
|
|
199
199
|
let possibleValueString = possibleValue
|
|
200
|
-
.filter((row) => row !== null)
|
|
201
200
|
.map((row) => {
|
|
202
201
|
return `"${row}"`
|
|
203
202
|
})
|
|
204
203
|
.join(", ")
|
|
205
204
|
|
|
206
|
-
const nullString =
|
|
207
|
-
possibleValue.filter((row) => row == null).length > 0
|
|
208
|
-
? "NULL"
|
|
209
|
-
: "NOT NULL"
|
|
210
|
-
|
|
211
205
|
await this.MyDB.query(
|
|
212
|
-
`ALTER TABLE ${tableName} MODIFY COLUMN ${columnName} ENUM(${possibleValueString})
|
|
206
|
+
`ALTER TABLE ${tableName} MODIFY COLUMN ${columnName} ENUM(${possibleValueString}) NOT NULL;`
|
|
213
207
|
)
|
|
214
208
|
}
|
|
215
209
|
}
|
package/src/myModel.ts
CHANGED