A bit more code styling in MySqlCommandInterpreter to avoid a ton of whitespace in the query

This commit is contained in:
Benedek Farkas
2025-10-18 20:55:49 +02:00
parent 94db9b85bd
commit 4d0c8b033b

View File

@@ -97,9 +97,9 @@ namespace Orchard.Data.Migration.Interpreters {
if (columnList.Count > 1) { if (columnList.Count > 1) {
sqlCommand.CommandText = $@" sqlCommand.CommandText = $@"
SELECT SUM(CHARACTER_MAXIMUM_LENGTH) SELECT SUM(CHARACTER_MAXIMUM_LENGTH)
FROM INFORMATION_SCHEMA.COLUMNS FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name = '{tableName}' WHERE table_name = '{tableName}'
AND COLUMN_NAME in ({columnNames}) AND COLUMN_NAME in ({columnNames})
AND TABLE_SCHEMA = '{session.Connection.Database}' AND TABLE_SCHEMA = '{session.Connection.Database}'
AND (Data_type = 'varchar');"; AND (Data_type = 'varchar');";
@@ -117,9 +117,9 @@ namespace Orchard.Data.Migration.Interpreters {
} }
// Check whether the index contains big nvarchar columns or text fields. // Check whether the index contains big nvarchar columns or text fields.
sqlCommand.CommandText = $@" sqlCommand.CommandText = $@"
SELECT COLUMN_NAME SELECT COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name = '{tableName}' WHERE table_name = '{tableName}'
AND COLUMN_NAME in ({columnNames}) AND COLUMN_NAME in ({columnNames})
AND TABLE_SCHEMA = '{session.Connection.Database}' AND TABLE_SCHEMA = '{session.Connection.Database}'
AND ((Data_type = 'varchar' and CHARACTER_MAXIMUM_LENGTH > {indexMaximumLength}) OR data_type= 'text');"; AND ((Data_type = 'varchar' and CHARACTER_MAXIMUM_LENGTH > {indexMaximumLength}) OR data_type= 'text');";