martinjw / dbschemareader

Read database metadata (from SqlServer/Oracle/MySql/SQLite/PostgreSql/DB2 etc) into one simple model
Microsoft Public License
293 stars 128 forks source link

SQL-Server - index columns order issue #51

Closed xverwaerde closed 7 years ago

xverwaerde commented 7 years ago

SQL-Server - The retrieved columns's order seems to be incorrect - as a consequence, schema comparison often fail and causes index DROP/Re-CREATE.

May I suggest to perform a change in "DatabaseSchemaReader.ProviderSchemaReaders.Databases.SqlServer.Indexes" constructor:

change "ORDER BY t.name, ind.name, col.name" by "ORDER BY t.name, ind.name, ic.index_column_id"

Thanks,

Xavier

martinjw commented 7 years ago

Thanks, done!