-
-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Column Ordering Changed after v1.2.0 for Embedded Structs #1095
Comments
Yes, your judgment is correct; it was caused by this 9052fc4c. I’m sorry for not maintaining full compatibility during this process. |
Thank you for confirming the cause. Could you clarify if this issue is planned to be resolved? If so, is there an estimated timeline for the fix? |
If necessary, we can add a flag to control whether to maintain the previous order. |
Description
After upgrading to bun v1.2.0, the column ordering in generated SQL tables has changed when using embedded structs. Previously, columns were created in the order they were defined in the struct (including embedded structs). However, in v1.2.0, the columns from embedded structs appear after the directly defined columns, regardless of their position in the struct definition.
Reproduction
Expected Behavior
The generated table should have columns in the order they are defined in the struct hierarchy:
id
created_at
name
Actual Behavior
After v1.2.0, the generated table has columns in this order:
name
id
created_at
The columns from the embedded
BaseModel
struct are placed after the directly definedName
column, which breaks the expected structural order.Version Information
Impact
This change affects systems that rely on consistent column ordering, particularly in scenarios where:
Additional Notes
The change in column ordering appears to be related to how bun v1.2.0 handles embedded struct fields during table creation. While this doesn't affect functionality, it represents a breaking change in terms of database schema generation.
The text was updated successfully, but these errors were encountered: