@mikro-orm/sql 7.1.9-dev.20 → 7.1.9-dev.22
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.
|
@@ -53,6 +53,7 @@ export declare class MySqlSchemaHelper extends SchemaHelper {
|
|
|
53
53
|
getPreAlterTable(tableDiff: TableDifference, safe: boolean): string[];
|
|
54
54
|
getRenameColumnSQL(tableName: string, oldColumnName: string, to: Column): string;
|
|
55
55
|
getRenameIndexSQL(tableName: string, index: IndexDef, oldIndexName: string): string[];
|
|
56
|
+
protected hasInlineColumnComment(): boolean;
|
|
56
57
|
getChangeColumnCommentSQL(tableName: string, to: Column, schemaName?: string): string;
|
|
57
58
|
alterTableColumn(column: Column, table: DatabaseTable, changedProperties: Set<string>): string[];
|
|
58
59
|
private getColumnDeclarationSQL;
|
|
@@ -540,6 +540,9 @@ export class MySqlSchemaHelper extends SchemaHelper {
|
|
|
540
540
|
const keyName = this.quote(index.keyName);
|
|
541
541
|
return [`alter table ${tableName} rename index ${oldIndexName} to ${keyName}`];
|
|
542
542
|
}
|
|
543
|
+
hasInlineColumnComment() {
|
|
544
|
+
return true;
|
|
545
|
+
}
|
|
543
546
|
getChangeColumnCommentSQL(tableName, to, schemaName) {
|
|
544
547
|
tableName = this.quote(tableName);
|
|
545
548
|
const columnName = this.quote(to.name);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/sql",
|
|
3
|
-
"version": "7.1.9-dev.
|
|
3
|
+
"version": "7.1.9-dev.22",
|
|
4
4
|
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"data-mapper",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@mikro-orm/core": "^7.1.8"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@mikro-orm/core": "7.1.9-dev.
|
|
56
|
+
"@mikro-orm/core": "7.1.9-dev.22"
|
|
57
57
|
},
|
|
58
58
|
"engines": {
|
|
59
59
|
"node": ">= 22.17.0"
|
package/schema/SchemaHelper.d.ts
CHANGED
|
@@ -143,6 +143,8 @@ export declare abstract class SchemaHelper {
|
|
|
143
143
|
}[];
|
|
144
144
|
}[], safe: boolean): string[];
|
|
145
145
|
getChangeColumnCommentSQL(tableName: string, to: Column, schemaName?: string): string;
|
|
146
|
+
/** Whether the column comment is part of the column declaration, as opposed to a separate statement. */
|
|
147
|
+
protected hasInlineColumnComment(): boolean;
|
|
146
148
|
getNamespaces(connection: AbstractSqlConnection, ctx?: Transaction): Promise<string[]>;
|
|
147
149
|
protected mapIndexes(indexes: IndexDef[]): Promise<IndexDef[]>;
|
|
148
150
|
mapForeignKeys(fks: any[], tableName: string, schemaName?: string): Dictionary;
|
package/schema/SchemaHelper.js
CHANGED
|
@@ -446,7 +446,8 @@ export class SchemaHelper {
|
|
|
446
446
|
this.append(ret, this.alterTableColumn(column, diff.fromTable, changedProperties));
|
|
447
447
|
}
|
|
448
448
|
for (const { column, changedProperties } of Object.values(diff.changedColumns).filter(diff => diff.changedProperties.has('comment'))) {
|
|
449
|
-
if (
|
|
449
|
+
if (this.hasInlineColumnComment() &&
|
|
450
|
+
['type', 'nullable', 'autoincrement', 'unsigned', 'default', 'enumItems', 'collation'].some(t => changedProperties.has(t))) {
|
|
450
451
|
continue; // will be handled via column update
|
|
451
452
|
}
|
|
452
453
|
ret.push(this.getChangeColumnCommentSQL(tableName, column, schemaName));
|
|
@@ -499,7 +500,13 @@ export class SchemaHelper {
|
|
|
499
500
|
return `add ${this.createTableColumn(column, table)}`;
|
|
500
501
|
})
|
|
501
502
|
.join(', ');
|
|
502
|
-
|
|
503
|
+
const ret = [`alter table ${table.getQuotedName()} ${adds}`];
|
|
504
|
+
if (!this.hasInlineColumnComment()) {
|
|
505
|
+
for (const column of columns.filter(column => column.comment)) {
|
|
506
|
+
ret.push(this.getChangeColumnCommentSQL(table.name, column, table.schema));
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
return ret;
|
|
503
510
|
}
|
|
504
511
|
getDropColumnsSQL(tableName, columns, schemaName) {
|
|
505
512
|
const name = this.quote(this.getTableName(tableName, schemaName));
|
|
@@ -618,6 +625,10 @@ export class SchemaHelper {
|
|
|
618
625
|
getChangeColumnCommentSQL(tableName, to, schemaName) {
|
|
619
626
|
return '';
|
|
620
627
|
}
|
|
628
|
+
/** Whether the column comment is part of the column declaration, as opposed to a separate statement. */
|
|
629
|
+
hasInlineColumnComment() {
|
|
630
|
+
return false;
|
|
631
|
+
}
|
|
621
632
|
async getNamespaces(connection, ctx) {
|
|
622
633
|
return [];
|
|
623
634
|
}
|