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

Custom check constraint name doesn't allow numbers or special character #672

Open
PBholewasi opened this issue Apr 26, 2023 · 0 comments
Open
Assignees

Comments

@PBholewasi
Copy link

Document Link

Your Question

The below name is allowed :
type Patient struct {
ID string json:"id" gorm:"primaryKey;column:id;"
Name string json:"name" gorm:"column:name"
Age int json:"age" gorm:"check:'chk_age_nine',age>99;column:age"
Gender string json:"gender" gorm:"column:gender"
CreatedAt int // Set to current time if it is zero on creating
UpdatedAt int // Set to current unix seconds on updating or if it is zero on creating
Deleted gorm.DeletedAt
}

Expected answer

The below name throws error :
type Patient struct {
ID string json:"id" gorm:"primaryKey;column:id;"
Name string json:"name" gorm:"column:name"
Age int json:"age" gorm:"check:'chk_age_99',age>99;column:age"
Gender string json:"gender" gorm:"column:gender"
CreatedAt int // Set to current time if it is zero on creating
UpdatedAt int // Set to current unix seconds on updating or if it is zero on creating
Deleted gorm.DeletedAt
}

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

No branches or pull requests

2 participants