fix: specify varchar(255) for slug columns to fix MySQL unique index error
Docker Build / Build and Push Docker Image (push) Successful in 4m11s

This commit is contained in:
2026-06-13 12:16:39 +08:00
parent 80bf73b41c
commit 5b9aa9e77a
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ import (
type Document struct {
Id int `json:"id" gorm:"primaryKey"`
Title string `json:"title" gorm:"not null"`
Slug string `json:"slug" gorm:"uniqueIndex;not null"`
Slug string `json:"slug" gorm:"type:varchar(255);uniqueIndex;not null"`
Content string `json:"content" gorm:"type:text;not null"`
CategoryId *int `json:"category_id" gorm:"index"`
Visibility string `json:"visibility" gorm:"default:'public'"` // public, auth, admin
+1 -1
View File
@@ -7,7 +7,7 @@ import (
type DocumentCategory struct {
Id int `json:"id" gorm:"primaryKey"`
Name string `json:"name" gorm:"not null"`
Slug string `json:"slug" gorm:"uniqueIndex;not null"`
Slug string `json:"slug" gorm:"type:varchar(255);uniqueIndex;not null"`
ParentId *int `json:"parent_id" gorm:"index"`
SortOrder int `json:"sort_order" gorm:"default:0"`
CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime"`