Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/entity/user_entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ type User struct {
Status int `xorm:"not null default 1 INT(11) status"`
AuthorityGroup int `xorm:"not null default 1 INT(11) authority_group"`
DisplayName string `xorm:"not null default '' VARCHAR(30) display_name"`
Avatar string `xorm:"not null default '' VARCHAR(1024) avatar"`
Avatar string `xorm:"not null default '' VARCHAR(2048) avatar"`
Mobile string `xorm:"not null VARCHAR(20) mobile"`
Bio string `xorm:"not null TEXT bio"`
BioHTML string `xorm:"not null TEXT bio_html"`
Expand Down
1 change: 1 addition & 0 deletions internal/migrations/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ var migrations = []Migration{
NewMigration("v1.5.1", "add plugin kv storage", addPluginKVStorage, true),
NewMigration("v1.6.0", "move user config to interface", moveUserConfigToInterface, true),
NewMigration("v1.7.0", "add optional tags", addOptionalTags, true),
NewMigration("v1.7.1", "expand avatar column length", expandAvatarColumnLength, false),
}

func GetMigrations() []Migration {
Expand Down
37 changes: 37 additions & 0 deletions internal/migrations/v29.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package migrations

import (
"context"
"fmt"

"xorm.io/xorm"
)

func expandAvatarColumnLength(ctx context.Context, x *xorm.Engine) error {
type User struct {
Avatar string `xorm:"not null default '' VARCHAR(2048) avatar"`
}
if err := x.Context(ctx).Sync(new(User)); err != nil {
return fmt.Errorf("expand avatar column length failed: %w", err)
}
return nil
}