Closed wirekang closed 1 year ago
It seems like this line is the cause of problem. https://github.com/koskimas/kysely/blob/23f004d4ebf55352b6d024b3702843dee6b41bb7/src/dialect/mysql/mysql-introspector.ts#L48
I found an issue https://github.com/koskimas/kysely/issues/146
Close this issue and I will continue from https://github.com/koskimas/kysely/issues/146.
Well found!
However, kysely-codegen
also includes code that sorts the tables and columns (and enums I believe) alphabetically. Why? Two reasons:
With that said, it may be a good idea to keep the sorting opt-in or opt-out, so this may be reopened in the future.
Note that orderBy('column_name')
and orderBy('ordinal_position')
are both consistent, so tests will never failed as long as the data is the same.
Of course, if the ordering is part of the tests, they will never fail. My gripe was that the tests kept failing as I were writing and changing them, but as long as the ordering is stable, I guess this may not be a problem.
Regardless, I have not considered column order to matter by design, so I have not taken it into account, but since others may find importance in column order, I should probably make this configurable.
It seems like kysely-codegen sort columns by alphabetically. Why? We have more then 50 columns, and the order is important for readability. Please consider to keep order from
INFORMATION_SCHEMA
.