-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
feat: add download count field and unit testing for attachment. #1512
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
Conversation
It takes a migration to add that new field, right ? |
@strk Yes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise LGTM
assert.NoError(t, PrepareTestDatabase()) | ||
|
||
attachment, err := GetAttachmentByUUID("1234567890") | ||
assert.NoError(t, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert.Equal(t, attachment.DownloadCount, int64(0))
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bkcsoft Done!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See 8278ac9
LGTM |
isn't this still lacking a migration ? |
models/attachment.go
Outdated
CommentID int64 | ||
ReleaseID int64 `xorm:"INDEX"` | ||
Name string | ||
DownloadCount int64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of migration, do this:
DownloadCount int64 `xorm:"DEFAULT 0"`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done e35bbb2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember @lunny calling for always adding a migration, not sure why
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to do that. I think we can begin to ask all schema changes should use https://github.com/go-xorm/xorm/tree/master/migrate
Signed-off-by: Bo-Yi Wu <[email protected]>
LGTM |
attachment
table. See GitHub API