diff --git a/backend/internal/api/handler/access_lists.go b/backend/internal/api/handler/access_lists.go index b006a640..6a8335d1 100644 --- a/backend/internal/api/handler/access_lists.go +++ b/backend/internal/api/handler/access_lists.go @@ -64,7 +64,7 @@ func CreateAccessList() func(http.ResponseWriter, *http.Request) { } // Get userID from token - userID, _ := r.Context().Value(c.UserIDCtxKey).(int) + userID, _ := r.Context().Value(c.UserIDCtxKey).(uint) newItem.UserID = userID if err = newItem.Save(); err != nil { diff --git a/backend/internal/api/handler/dns_providers.go b/backend/internal/api/handler/dns_providers.go index 40966cad..1a98c4b1 100644 --- a/backend/internal/api/handler/dns_providers.go +++ b/backend/internal/api/handler/dns_providers.go @@ -70,7 +70,7 @@ func CreateDNSProvider() func(http.ResponseWriter, *http.Request) { } // Get userID from token - userID, _ := r.Context().Value(c.UserIDCtxKey).(int) + userID, _ := r.Context().Value(c.UserIDCtxKey).(uint) newItem.UserID = userID if err = newItem.Save(); err != nil { diff --git a/backend/internal/api/handler/nginx_templates.go b/backend/internal/api/handler/nginx_templates.go index 32fb68f2..2a4bb9ce 100644 --- a/backend/internal/api/handler/nginx_templates.go +++ b/backend/internal/api/handler/nginx_templates.go @@ -68,7 +68,7 @@ func CreateNginxTemplate() func(http.ResponseWriter, *http.Request) { } // Get userID from token - userID, _ := r.Context().Value(c.UserIDCtxKey).(int) + userID, _ := r.Context().Value(c.UserIDCtxKey).(uint) newNginxTemplate.UserID = userID if err = newNginxTemplate.Save(); err != nil { diff --git a/backend/internal/api/handler/streams.go b/backend/internal/api/handler/streams.go index 0c2b8fbd..2cb87106 100644 --- a/backend/internal/api/handler/streams.go +++ b/backend/internal/api/handler/streams.go @@ -68,7 +68,7 @@ func CreateStream() func(http.ResponseWriter, *http.Request) { } // Get userID from token - userID, _ := r.Context().Value(c.UserIDCtxKey).(int) + userID, _ := r.Context().Value(c.UserIDCtxKey).(uint) newHost.UserID = userID if err = newHost.Save(); err != nil { diff --git a/backend/internal/database/migrator.go b/backend/internal/database/migrator.go index d8c46f6a..9e41535b 100644 --- a/backend/internal/database/migrator.go +++ b/backend/internal/database/migrator.go @@ -20,6 +20,7 @@ func Migrate(followup afterMigrationComplete) bool { dbURL := config.Configuration.DB.GetDBMateConnectURL() u, _ := url.Parse(dbURL) db := dbmate.New(u) + db.AutoDumpSchema = false db.FS = embed.MigrationFiles db.MigrationsDir = []string{fmt.Sprintf("./migrations/%s", config.Configuration.DB.GetDriver())} diff --git a/backend/internal/entity/accesslist/model.go b/backend/internal/entity/accesslist/model.go index 342236df..49bd6aa9 100644 --- a/backend/internal/entity/accesslist/model.go +++ b/backend/internal/entity/accesslist/model.go @@ -12,7 +12,7 @@ import ( // Model is the model type Model struct { entity.ModelBase - UserID int `json:"user_id" gorm:"column:user_id" filter:"user_id,integer"` + UserID uint `json:"user_id" gorm:"column:user_id" filter:"user_id,integer"` Name string `json:"name" gorm:"column:name" filter:"name,string"` Meta types.JSONB `json:"meta" gorm:"column:meta"` // Expansions diff --git a/backend/internal/entity/dnsprovider/model.go b/backend/internal/entity/dnsprovider/model.go index 10afb725..86bcb5a1 100644 --- a/backend/internal/entity/dnsprovider/model.go +++ b/backend/internal/entity/dnsprovider/model.go @@ -15,7 +15,7 @@ import ( // Model is the model type Model struct { entity.ModelBase - UserID int `json:"user_id" gorm:"column:user_id" filter:"user_id,integer"` + UserID uint `json:"user_id" gorm:"column:user_id" filter:"user_id,integer"` Name string `json:"name" gorm:"column:name" filter:"name,string"` AcmeshName string `json:"acmesh_name" gorm:"column:acmesh_name" filter:"acmesh_name,string"` DNSSleep int `json:"dns_sleep" gorm:"column:dns_sleep" filter:"dns_sleep,integer"` diff --git a/backend/internal/entity/nginxtemplate/model.go b/backend/internal/entity/nginxtemplate/model.go index 18953344..ec2359cb 100644 --- a/backend/internal/entity/nginxtemplate/model.go +++ b/backend/internal/entity/nginxtemplate/model.go @@ -10,7 +10,7 @@ import ( // Model is the model type Model struct { entity.ModelBase - UserID int `json:"user_id" gorm:"column:user_id" filter:"user_id,integer"` + UserID uint `json:"user_id" gorm:"column:user_id" filter:"user_id,integer"` Name string `json:"name" gorm:"column:name" filter:"name,string"` Type string `json:"type" gorm:"column:type" filter:"type,string"` Template string `json:"template" gorm:"column:template" filter:"template,string"` diff --git a/backend/internal/entity/stream/model.go b/backend/internal/entity/stream/model.go index e5ce1152..6bd6771e 100644 --- a/backend/internal/entity/stream/model.go +++ b/backend/internal/entity/stream/model.go @@ -12,7 +12,7 @@ import ( type Model struct { entity.ModelBase ExpiresOn types.DBDate `json:"expires_on" gorm:"column:expires_on" filter:"expires_on,integer"` - UserID int `json:"user_id" gorm:"column:user_id" filter:"user_id,integer"` + UserID uint `json:"user_id" gorm:"column:user_id" filter:"user_id,integer"` Provider string `json:"provider" gorm:"column:provider" filter:"provider,string"` Name string `json:"name" gorm:"column:name" filter:"name,string"` DomainNames types.JSONB `json:"domain_names" gorm:"column:domain_names" filter:"domain_names,string"`