Skip to content

Commit 04a088e

Browse files
committed
Remove column order from indexes
The order of the columns doesn't matter
1 parent 6703f6b commit 04a088e

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

SQLiteSharp/SQLiteConnection.cs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -176,17 +176,12 @@ public CreateTableResult CreateTable(Type type, string? virtualModuleName = null
176176
throw new Exception("Every column in an index must have the same value for their Unique property.");
177177
}
178178

179-
indexInfo.Columns.Add(new IndexedColumn() {
180-
Order = index.Order,
181-
ColumnName = column.Name,
182-
});
179+
indexInfo.Columns.Add(column.Name);
183180
}
184181
}
185182
// Create indexes for columns
186-
foreach (string indexName in indexes.Keys) {
187-
IndexInfo index = indexes[indexName];
188-
string[] columns = index.Columns.OrderBy(i => i.Order).Select(i => i.ColumnName).ToArray();
189-
CreateIndex(indexName, index.TableName, columns, index.Unique);
183+
foreach (IndexInfo index in indexes.Values) {
184+
CreateIndex(index.IndexName, index.TableName, index.Columns, index.Unique);
190185
}
191186

192187
return result;
@@ -970,14 +965,9 @@ public Task ChangeKeyAsync(byte[] key) {
970965
}
971966
}
972967

973-
file struct IndexedColumn {
974-
public int Order;
975-
public string ColumnName;
976-
}
977-
978968
file struct IndexInfo {
979969
public string IndexName;
980970
public string TableName;
981971
public bool Unique;
982-
public List<IndexedColumn> Columns;
972+
public List<string> Columns;
983973
}

0 commit comments

Comments
 (0)