Skip to content

Commit 20b5e1e

Browse files
committed
added warning
1 parent b17ab4c commit 20b5e1e

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/migrations/sql-server/SqlServerAutomaticMigrations.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,21 @@ export default class SqlServerAutomaticMigrations extends SqlServerMigrations {
124124
const indexName = index.name;
125125
const columns = [];
126126
let spatial = true;
127+
let nonSpatial = false;
127128
for (const column of index.columns) {
128129
const columnName = column.name;
129130
const c = type.getColumn(column.name);
130131
const isColumnSpatial = isSpatialType(c.dataType);
131132
spatial &&= isColumnSpatial;
133+
nonSpatial ||= !isColumnSpatial;
132134
columns.push(`${columnName} ${ isSpatialType(c.dataType) ? "" : (column.descending ? "DESC" : "ASC")}`);
133135
}
134136

137+
if (nonSpatial && spatial) {
138+
console.warn(`SQL SERVER DOEST NOT SUPPORT SPATIAL AND OTHER DATATYPE INDEX so ${name} index is not created`);
139+
return;
140+
}
141+
135142
const indexType = spatial ? " SPATIAL " : "";
136143

137144
let query = `IF NOT EXISTS(SELECT * FROM sys.indexes WHERE name = '${indexName}' AND object_id = OBJECT_ID('${name}'))

0 commit comments

Comments
 (0)