You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sorry for skipping the playground PR, but I think the below snippet should explain the issue well enough.
Description
It took me a couple of hours to figure out the following issue. When parsing the DDL as part of AutoMigrate, an error will occur if the original SQL statement wasn't fully uppercase.
2022/04/03 17:07:23 /home/ferdinand/go/pkg/mod/gorm.io/driver/[email protected]/migrator.go:33
[0.025ms] [rows:-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="foos"
2022/04/03 17:07:23 /home/ferdinand/go/pkg/mod/gorm.io/driver/[email protected]/migrator.go:106
[0.062ms] [rows:2] SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "foos" AND sql IS NOT NULL order by type = "table" desc
2022/04/03 17:07:23 /tmp/gorm-bug/main.go:23 duplicate column name: id
[0.012ms] [rows:0] ALTER TABLE `foos` ADD `id` integer
panic: duplicate column name: id
goroutine 1 [running]:
main.main()
/tmp/gorm-bug/main.go:24 +0x23a
Process finished with the exit code 2
So when manually running a DDL statement that is valid, yet not correctly formatted, auto migrations for that table will break forever until you explicitly fix it.
Would be very helpful if the regexes were case-insensitive and only check for correct syntax instead.
Sorry for skipping the playground PR, but I think the below snippet should explain the issue well enough.
Description
It took me a couple of hours to figure out the following issue. When parsing the DDL as part of
AutoMigrate
, an error will occur if the original SQL statement wasn't fully uppercase.Here's the output:
So when manually running a DDL statement that is valid, yet not correctly formatted, auto migrations for that table will break forever until you explicitly fix it.
Would be very helpful if the regexes were case-insensitive and only check for correct syntax instead.
go.mod
The text was updated successfully, but these errors were encountered: