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
I have a table named resource and have defined a struct for it. However, I now need to add a new field to the table, but when this field is not yet added to the struct definition in the code, running the code results in an error: "missing destination name scene_type in *[]*model.Resource." ,even though I didn't use this field .
How can I avoid this error? Since database changes and code changes are not deployed simultaneously, this could cause issues when the service goes live.
Example code
typeResourcestruct {
Idint`db:"id" json:"id"`CompanyIdint`db:"company_id" json:"companyId"`Pidint`db:"pid" json:"pid"`CreatorIdint`db:"creator_id" json:"creatorId"`Sizeint64`db:"size" json:"size"`Widthint`db:"width" json:"width"`Heightint`db:"height" json:"height"`IsFolderbool`db:"is_folder" json:"isFolder"`Trashedbool`db:"trashed" json:"trashed"`TypeResourceType`db:"type" json:"type"`Filenamestring`db:"filename" json:"filename"`Extensionstring`db:"extension" json:"extension"`Thumbnailstring`db:"thumbnail" json:"thumbnail"`// SceneType int `db:"scene_type" json:"sceneType"` //if I not add this it will be error,even though I didn't use this field
}
Error log
missing destination name scene_type in *[]*model.Resource
The text was updated successfully, but these errors were encountered:
Issue description
I have a table named resource and have defined a struct for it. However, I now need to add a new field to the table, but when this field is not yet added to the struct definition in the code, running the code results in an error: "missing destination name scene_type in *[]*model.Resource." ,even though I didn't use this field .
How can I avoid this error? Since database changes and code changes are not deployed simultaneously, this could cause issues when the service goes live.
Example code
Error log
The text was updated successfully, but these errors were encountered: