You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@answer.apache.org by li...@apache.org on 2026/03/02 09:37:49 UTC
(answer) branch dev updated (d6cb1b11 -> ff997cb0)
This is an automated email from the ASF dual-hosted git repository.
linkinstar pushed a change to branch dev
in repository https://gitbox.apache.org/repos/asf/answer.git
from d6cb1b11 fix: update bubble user background color for dark mode
new 844c73cd fix: change avatar column type to TEXT to support long URLs
new 09599e4c style: apply gofmt formatting
new ff997cb0 fix: update migration version to v2.0.1 and remove default value for TEXT column
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
internal/entity/user_entity.go | 2 +-
internal/migrations/migrations.go | 1 +
internal/migrations/{v19.go => v32.go} | 12 +++++++-----
3 files changed, 9 insertions(+), 6 deletions(-)
copy internal/migrations/{v19.go => v32.go} (73%)
(answer) 03/03: fix: update migration version to v2.0.1 and remove default value for TEXT column
Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
linkinstar pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/answer.git
commit ff997cb0142fc8f1943a726a86ea1a514d57e044
Author: maishivamhoo123 <ma...@gmail.com>
AuthorDate: Mon Feb 9 12:27:17 2026 +0530
fix: update migration version to v2.0.1 and remove default value for TEXT column
---
internal/entity/user_entity.go | 2 +-
internal/migrations/migrations.go | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/internal/entity/user_entity.go b/internal/entity/user_entity.go
index 5e9eed18..8aac4c7c 100644
--- a/internal/entity/user_entity.go
+++ b/internal/entity/user_entity.go
@@ -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 '' TEXT avatar"`
+ Avatar string `xorm:"not null TEXT avatar"`
Mobile string `xorm:"not null VARCHAR(20) mobile"`
Bio string `xorm:"not null TEXT bio"`
BioHTML string `xorm:"not null TEXT bio_html"`
diff --git a/internal/migrations/migrations.go b/internal/migrations/migrations.go
index a1393955..682a7b20 100644
--- a/internal/migrations/migrations.go
+++ b/internal/migrations/migrations.go
@@ -107,7 +107,7 @@ var migrations = []Migration{
NewMigration("v1.7.2", "expand avatar column length", expandAvatarColumnLength, false),
NewMigration("v1.8.0", "change admin menu", updateAdminMenuSettings, true),
NewMigration("v1.8.1", "ai feat", aiFeat, true),
- NewMigration("v1.8.2", "change avatar type to text", updateAvatarType, false),
+ NewMigration("v2.0.1", "change avatar type to text", updateAvatarType, false),
}
func GetMigrations() []Migration {
(answer) 01/03: fix: change avatar column type to TEXT to support long URLs
Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
linkinstar pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/answer.git
commit 844c73cd7fbb893e17bf4435288626241bf58b9d
Author: maishivamhoo123 <ma...@gmail.com>
AuthorDate: Fri Feb 6 22:07:53 2026 +0530
fix: change avatar column type to TEXT to support long URLs
---
internal/entity/user_entity.go | 2 +-
internal/migrations/migrations.go | 1 +
internal/migrations/v32.go | 37 +++++++++++++++++++++++++++++++++++++
3 files changed, 39 insertions(+), 1 deletion(-)
diff --git a/internal/entity/user_entity.go b/internal/entity/user_entity.go
index 8e63fc95..5e9eed18 100644
--- a/internal/entity/user_entity.go
+++ b/internal/entity/user_entity.go
@@ -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(2048) avatar"`
+ Avatar string `xorm:"not null default '' TEXT avatar"`
Mobile string `xorm:"not null VARCHAR(20) mobile"`
Bio string `xorm:"not null TEXT bio"`
BioHTML string `xorm:"not null TEXT bio_html"`
diff --git a/internal/migrations/migrations.go b/internal/migrations/migrations.go
index 33453ef1..a1393955 100644
--- a/internal/migrations/migrations.go
+++ b/internal/migrations/migrations.go
@@ -107,6 +107,7 @@ var migrations = []Migration{
NewMigration("v1.7.2", "expand avatar column length", expandAvatarColumnLength, false),
NewMigration("v1.8.0", "change admin menu", updateAdminMenuSettings, true),
NewMigration("v1.8.1", "ai feat", aiFeat, true),
+ NewMigration("v1.8.2", "change avatar type to text", updateAvatarType, false),
}
func GetMigrations() []Migration {
diff --git a/internal/migrations/v32.go b/internal/migrations/v32.go
new file mode 100644
index 00000000..5ef0f0a0
--- /dev/null
+++ b/internal/migrations/v32.go
@@ -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"
+
+ "github.com/apache/answer/internal/entity"
+ "xorm.io/xorm"
+)
+
+func updateAvatarType(ctx context.Context, x *xorm.Engine) error {
+ // Sync the User struct to the database.
+ // Since you changed the struct to use TEXT, this will update the column type.
+ if err := x.Context(ctx).Sync(new(entity.User)); err != nil {
+ return fmt.Errorf("sync user table failed: %w", err)
+ }
+ return nil
+}
(answer) 02/03: style: apply gofmt formatting
Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
linkinstar pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/answer.git
commit 09599e4c20699990c5303748b27428701315148a
Author: maishivamhoo123 <ma...@gmail.com>
AuthorDate: Fri Feb 6 22:27:05 2026 +0530
style: apply gofmt formatting
---
internal/migrations/v32.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/internal/migrations/v32.go b/internal/migrations/v32.go
index 5ef0f0a0..fc6614b1 100644
--- a/internal/migrations/v32.go
+++ b/internal/migrations/v32.go
@@ -7,7 +7,7 @@
* "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
+ * 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