GORM Playground Link

https://github.com/go-gorm/playground/pull/1

Description

背景信息: go:1.18 gorm:1.23.8 sqlite3

结构体如下

type MyTest struct {
    Name string `gorm:"default:中文"`
    gorm.Model
}

在首次运行 db.AutoMigrate(&MyTest{}) 时没问题的,但是在第二次运行时就会报如下错误:

panic: runtime error: index out of range [122] with length 122

goroutine 1 [running]:
gorm.io/driver/sqlite.parseDDL({0xc0003ff540, 0x2, 0xc000118b58?})
        D:/developSoftware/Go/pkg/mod/gorm.io/driver/sqlite@v1.3.1/ddlmod.go:45 +0xe30
gorm.io/driver/sqlite.Migrator.ColumnTypes.func1(0xc00053a540)
        D:/developSoftware/Go/pkg/mod/gorm.io/driver/sqlite@v1.3.1/migrator.go:110 +0x1a5
gorm.io/gorm/migrator.Migrator.RunWithValue({{0x0?, 0xc0002721b0?, {0x11f0a18?, 0xc000272240?}}}, {0x1030520?, 0xc0002530a0}, 0xc0004339c0)
        D:/developSoftware/Go/pkg/mod/gorm.io/gorm@v1.23.8/migrator/migrator.go:52 +0x13c
gorm.io/driver/sqlite.Migrator.ColumnTypes({{{0x0?, 0xc0002721b0?, {0x11f0a18?, 0xc000272240?}}}}, {0x1030520, 0xc0002530a0})
        D:/developSoftware/Go/pkg/mod/gorm.io/driver/sqlite@v1.3.1/migrator.go:100 +0xf8
gorm.io/gorm/migrator.Migrator.AutoMigrate.func1(0xc00053a1c0)
        D:/developSoftware/Go/pkg/mod/gorm.io/gorm@v1.23.8/migrator/migrator.go:102 +0x78
gorm.io/gorm/migrator.Migrator.RunWithValue({{0xc0?, 0xc000088fc0?, {0x11f0a18?, 0xc000088ff0?}}}, {0x1030520?, 0xc0002530a0}, 0xc000433db0)
        D:/developSoftware/Go/pkg/mod/gorm.io/gorm@v1.23.8/migrator/migrator.go:52 +0x13c
gorm.io/gorm/migrator.Migrator.AutoMigrate({{0x0?, 0xc000088fc0?, {0x11f0a18?, 0xc000088ff0?}}}, {0xc000033e00?, 0x0?, 0x0?})
        D:/developSoftware/Go/pkg/mod/gorm.io/gorm@v1.23.8/migrator/migrator.go:101 +0x1ce
gorm.io/gorm.(*DB).AutoMigrate(0xc000057f10?, {0xc000033e00, 0x4, 0x4})
        D:/developSoftware/Go/pkg/mod/gorm.io/gorm@v1.23.8/migrator.go:28 +0x43

Comment From: github-actions[bot]

The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.io ✨ Search Before Asking

Comment From: github-actions[bot]

The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.io ✨ Search Before Asking

Comment From: li-jin-gou

It is OK to use the latest version.

[0.012ms] [rows:-] SELECT count(*) FROM sqlite_master WHERE type='table' AND name="my_tests"

[0.553ms] [rows:0] CREATE TABLE `my_tests` (`name` text DEFAULT "中文",`id` integer,`created_at` datetime,`updated_at` datetime,`deted_at` datetime,PRIMARY KEY (`id`))

[0.586ms] [rows:0] CREATE INDEX `idx_my_tests_deleted_at` ON `my_tests`(`deleted_at`)