mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2026-06-19 07:36:59 +00:00
refactor:(cert) migrate domains to json array
This commit is contained in:
@@ -32,7 +32,6 @@ require (
|
||||
github.com/golang-jwt/jwt/v5 v5.2.2
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/gorilla/websocket v1.5.3
|
||||
github.com/lib/pq v1.10.9
|
||||
github.com/mark3labs/mcp-go v0.32.0
|
||||
github.com/minio/selfupdate v0.6.0
|
||||
github.com/nikoksr/notify v1.3.0
|
||||
@@ -206,6 +205,7 @@ require (
|
||||
github.com/labbsr0x/bindman-dns-webhook v1.0.2 // indirect
|
||||
github.com/labbsr0x/goh v1.0.1 // indirect
|
||||
github.com/leodido/go-urn v1.4.0 // indirect
|
||||
github.com/lib/pq v1.10.9 // indirect
|
||||
github.com/libdns/alidns v1.0.4 // indirect
|
||||
github.com/libdns/cloudflare v0.2.1 // indirect
|
||||
github.com/libdns/huaweicloud v1.0.0-beta.2 // indirect
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package migrate
|
||||
|
||||
import (
|
||||
"github.com/go-gormigrate/gormigrate/v2"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
var UpdateCertDomains = &gormigrate.Migration{
|
||||
ID: "20250706000001",
|
||||
Migrate: func(tx *gorm.DB) error {
|
||||
// Update domains field in certs table: replace { with [ and } with ]
|
||||
if err := tx.Exec("UPDATE certs SET domains = REPLACE(REPLACE(domains, '{', '['), '}', ']')").Error; err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
},
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
var Migrations = []*gormigrate.Migration{
|
||||
SiteCategoryToEnvGroup,
|
||||
RenameAuthsToUsers,
|
||||
UpdateCertDomains,
|
||||
}
|
||||
|
||||
var BeforeAutoMigrate = []*gormigrate.Migration{
|
||||
|
||||
+1
-2
@@ -7,7 +7,6 @@ import (
|
||||
"github.com/0xJacky/Nginx-UI/internal/nginx"
|
||||
"github.com/go-acme/lego/v4/certcrypto"
|
||||
"github.com/go-acme/lego/v4/certificate"
|
||||
"github.com/lib/pq"
|
||||
"gorm.io/gorm/clause"
|
||||
)
|
||||
|
||||
@@ -32,7 +31,7 @@ type CertificateResource struct {
|
||||
type Cert struct {
|
||||
Model
|
||||
Name string `json:"name"`
|
||||
Domains pq.StringArray `json:"domains" gorm:"type:text[]"`
|
||||
Domains []string `json:"domains" gorm:"serializer:json"`
|
||||
Filename string `json:"filename"`
|
||||
SSLCertificatePath string `json:"ssl_certificate_path"`
|
||||
SSLCertificateKeyPath string `json:"ssl_certificate_key_path"`
|
||||
|
||||
Reference in New Issue
Block a user