File tree Expand file tree Collapse file tree
src/migrations/sql-server Expand file tree Collapse file tree Original file line number Diff line number Diff 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 } '))
You can’t perform that action at this time.
0 commit comments