-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Drop redundant columns from issue_user table #638
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
7f9b9f7
to
4da8292
Compare
Build error. |
4da8292
to
e0a2375
Compare
@appleboy Fixed, thanks for the heads up! |
@@ -166,6 +166,18 @@ func (issue *Issue) LoadAttributes() error { | |||
return issue.loadAttributes(x) | |||
} | |||
|
|||
// GetIsRead load the `IsRead` field of the issue | |||
func (issue *Issue) GetIsRead(userID int64) error { |
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.
Since we have notification system, it seems is_read is not needed.
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.
The IsRead
field is still used (in /templates/repo/issue/list.tmpl
).
While it might make sense to eventually remove the is_read column, it seems outside the scope of this PR.
IsRead bool | ||
IsAssigned bool | ||
IsMentioned bool |
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.
If IsMentioned and IsAssigned have been notified to user, the whole table will not be needed. @andreynering
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.
We still need to support searching for issues that a particular user is mentioned in, right?
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 think IsAssigned
is not actually redundant?
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.
The issue
table has an assignee_id
column, and gitea only supports one assignee per repo issue
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.
Oh. We need keep IsAssigned
currently and drop assignee_id
on issue
in future.
e0a2375
to
aef2f4e
Compare
I've un-removed the |
aef2f4e
to
58db248
Compare
if _, err := x.Exec("ALTER TABLE issue_user DROP COLUMN is_poster"); err != nil { | ||
return err | ||
} | ||
if _, err := x.Exec("ALTER TABLE issue_user DROP COLUMN is_closed"); err != nil { |
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.
On Gogs, the convention was never delete columns in the DB to prevent break anything, specially if user tries to rollback to a previous version of Gogs/Gitea.
Should we keep this convention?
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.
^
Let's mark it depreciated firstly and don't use them.
One more comment. Otherwise LGTM. |
@lunny @andreynering I've removed the migration; is there anything I have to do to explicitly mark the columns as deprecated? |
No, just removing the struct field is OK. |
8c5de5f
to
b8d96b9
Compare
Build error |
b8d96b9
to
04b3bf2
Compare
LGTM |
Drops
repo_id, milestone_id, is_poster, is_closed
columns. See #636