-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Restrict some tables' columns size #14075
Conversation
Please provide reasoning for why this PR is necessary and why only these specific columns were changed. |
6e106c6
to
d2f008e
Compare
I have updated the issue content and explain the reason there. |
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.
Also conflicts
models/migrations/v163.go
Outdated
Type string `xorm:"VARCHAR(32) INDEX NOT NULL"` | ||
OriginalAuthor string `xorm:"VARCHAR(64) INDEX"` | ||
} | ||
if err := x.Sync2(new(Reaction)); 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.
This will not work. Sync2
will only modify columns from small length to big length but not opposite.
d2f008e
to
f1a8613
Compare
Close as too many conflicts. |
As title.
UPDATE 1:
The default size of a string in XORM is 255, for most things, it's OK.
But for an index, the size will affect the performance.
According this PR,
Type
on reaction table is an index and will be+1
,like
and etc. 32 chars is enough for that.OriginalAuthor, LoginName, Name is related with User, in fact, login name have been restricted on
module/auth/user_form.go
which is40
chars. So no reason to use a column with 255 to store that.