Commit 5217937
fix(mysql/ddl): DEFAULT NULL must imply nullable column
When a field carries `default:null` (e.g. SoftDeletedAt) GORM sets
DefaultValue="null" but the column.Nullable flag was never set to true
unless the Go type was a pointer or the NULLABLE tag was present.
This produced the contradictory DDL:
`deleted_at` timestamp DEFAULT null NOT NULL
which MySQL/MariaDB rejects with Error 1067.
Fix: after the pointer/NULLABLE check, force column.Nullable=true
whenever column.Default is "null" (case-insensitive). A column that
defaults to NULL cannot be NOT NULL.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent b2ec413 commit 5217937
1 file changed
+7
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
145 | 152 | | |
146 | 153 | | |
147 | 154 | | |
| |||
0 commit comments