Skip to content
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

sqlite AutoMigrate时报错converting argument $1 type: unsupported type clause.Expr, a struct #4960

Closed
strive1216 opened this issue Dec 27, 2021 · 4 comments
Assignees
Labels

Comments

@strive1216
Copy link

strive1216 commented Dec 27, 2021

Description

在v1.22.4报错:gorm.io/driver/sqlite@v1.1.4/migrator.go:108 sql: converting argument $1 type: unsupported type clause.Expr, a struct
降到v1.22.3正常的

CREATE TABLE `tb_sys_menu` (
  "id" integer primary key autoincrement,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_by` integer NOT NULL DEFAULT 0,
  `updated_by` integer NOT NULL DEFAULT 0,
  `status` tinyint(1) NOT NULL,"memo" varchar(64),
  `parent_id` integer NOT NULL,
  "url" varchar(72),
  `name` text NOT NULL,
  `sequence` integer NOT NULL,
  `menu_type` tinyint(1) NOT NULL,
  `code` text NOT NULL,
  "icon" varchar(32),
  "operate_type" varchar(32) NOT NULL 
)

执行AutoMigrate动作:
image

在执行"INSERT INTO tb_sys_menu__temp ...."时
image
使用了并不需要的clause.Expr Vars 导致出错
image

@github-actions github-actions bot added the type:missing reproduction steps missing reproduction steps label Dec 27, 2021
@github-actions
Copy link

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 2 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.ioSearch Before Asking

@strive1216 strive1216 changed the title sqlite 自动迁移时报错 sqlite AutoMigrate时在v1.22.4报错,降到v1.21.11正常的 Dec 27, 2021
@strive1216 strive1216 changed the title sqlite AutoMigrate时在v1.22.4报错,降到v1.21.11正常的 sqlite AutoMigrate时在v1.22.4报错,降到v1.22.3正常的 Dec 27, 2021
@strive1216 strive1216 changed the title sqlite AutoMigrate时在v1.22.4报错,降到v1.22.3正常的 sqlite AutoMigrate时报错converting argument $1 type: unsupported type clause.Expr, a struct Dec 27, 2021
@ghost
Copy link

ghost commented Dec 27, 2021

提了一个可以复现的demo 放在 https://github.com/go-gorm/playground 吧~

@github-actions
Copy link

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 2 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.ioSearch Before Asking

@unknwon
Copy link

unknwon commented Jun 7, 2022

For anyone who comes here, update github.com/go-gorm/sqlite to 1.3.2 fixed this. No did not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants