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

fix: For time type, the time field will be automatically updated. Eve… #7316

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jackma009
Copy link

@jackma009 jackma009 commented Dec 12, 2024

  • Do only one thing
  • Non breaking API changes
  • Tested

fix: For time type, the time field will be automatically updated. Even if the table structure is not changed, the table modification operation will be repeated.

fix:时间类型,自动更新时间字段会。表结构没改动,也会重复 执行改表操作。

User Case Description

// Table Structure
// 表结构
type CreateUpdateTimeAt struct {
CreatedAt time.Time gorm:"column:created_at;type:timestamp(3);default:CURRENT_TIMESTAMP(3);index:created_idx;" json:"created_at"
UpdatedAt time.Time gorm:"column:updated_at;type:timestamp(3);default:CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3);" json:"updated_at"
}

// SQL to modify the table. Even if the table is not modified, it will be executed every time.
// 改表的SQL。表没改动,每次也会执行。
2024/12/12 16:15:50 /xxxx/service_context.go:46
[118.788ms] [rows:0] ALTER TABLE tenant_third_config MODIFY COLUMN updated_at timestamp(3) DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)

…n if the table structure is not changed, the table modification operation will be repeated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants