mirror of
https://github.com/xiaoxinpro/nginx-proxy-manager-zh.git
synced 2025-03-14 17:48:14 -04:00
Skip auto dumping database migration
Fix user id from context
This commit is contained in:
parent
cbcb0cc0f8
commit
dde368f733
@ -64,7 +64,7 @@ func CreateAccessList() func(http.ResponseWriter, *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get userID from token
|
// Get userID from token
|
||||||
userID, _ := r.Context().Value(c.UserIDCtxKey).(int)
|
userID, _ := r.Context().Value(c.UserIDCtxKey).(uint)
|
||||||
newItem.UserID = userID
|
newItem.UserID = userID
|
||||||
|
|
||||||
if err = newItem.Save(); err != nil {
|
if err = newItem.Save(); err != nil {
|
||||||
|
@ -70,7 +70,7 @@ func CreateDNSProvider() func(http.ResponseWriter, *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get userID from token
|
// Get userID from token
|
||||||
userID, _ := r.Context().Value(c.UserIDCtxKey).(int)
|
userID, _ := r.Context().Value(c.UserIDCtxKey).(uint)
|
||||||
newItem.UserID = userID
|
newItem.UserID = userID
|
||||||
|
|
||||||
if err = newItem.Save(); err != nil {
|
if err = newItem.Save(); err != nil {
|
||||||
|
@ -68,7 +68,7 @@ func CreateNginxTemplate() func(http.ResponseWriter, *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get userID from token
|
// Get userID from token
|
||||||
userID, _ := r.Context().Value(c.UserIDCtxKey).(int)
|
userID, _ := r.Context().Value(c.UserIDCtxKey).(uint)
|
||||||
newNginxTemplate.UserID = userID
|
newNginxTemplate.UserID = userID
|
||||||
|
|
||||||
if err = newNginxTemplate.Save(); err != nil {
|
if err = newNginxTemplate.Save(); err != nil {
|
||||||
|
@ -68,7 +68,7 @@ func CreateStream() func(http.ResponseWriter, *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get userID from token
|
// Get userID from token
|
||||||
userID, _ := r.Context().Value(c.UserIDCtxKey).(int)
|
userID, _ := r.Context().Value(c.UserIDCtxKey).(uint)
|
||||||
newHost.UserID = userID
|
newHost.UserID = userID
|
||||||
|
|
||||||
if err = newHost.Save(); err != nil {
|
if err = newHost.Save(); err != nil {
|
||||||
|
@ -20,6 +20,7 @@ func Migrate(followup afterMigrationComplete) bool {
|
|||||||
dbURL := config.Configuration.DB.GetDBMateConnectURL()
|
dbURL := config.Configuration.DB.GetDBMateConnectURL()
|
||||||
u, _ := url.Parse(dbURL)
|
u, _ := url.Parse(dbURL)
|
||||||
db := dbmate.New(u)
|
db := dbmate.New(u)
|
||||||
|
db.AutoDumpSchema = false
|
||||||
db.FS = embed.MigrationFiles
|
db.FS = embed.MigrationFiles
|
||||||
db.MigrationsDir = []string{fmt.Sprintf("./migrations/%s", config.Configuration.DB.GetDriver())}
|
db.MigrationsDir = []string{fmt.Sprintf("./migrations/%s", config.Configuration.DB.GetDriver())}
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
// Model is the model
|
// Model is the model
|
||||||
type Model struct {
|
type Model struct {
|
||||||
entity.ModelBase
|
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"`
|
Name string `json:"name" gorm:"column:name" filter:"name,string"`
|
||||||
Meta types.JSONB `json:"meta" gorm:"column:meta"`
|
Meta types.JSONB `json:"meta" gorm:"column:meta"`
|
||||||
// Expansions
|
// Expansions
|
||||||
|
@ -15,7 +15,7 @@ import (
|
|||||||
// Model is the model
|
// Model is the model
|
||||||
type Model struct {
|
type Model struct {
|
||||||
entity.ModelBase
|
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"`
|
Name string `json:"name" gorm:"column:name" filter:"name,string"`
|
||||||
AcmeshName string `json:"acmesh_name" gorm:"column:acmesh_name" filter:"acmesh_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"`
|
DNSSleep int `json:"dns_sleep" gorm:"column:dns_sleep" filter:"dns_sleep,integer"`
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
// Model is the model
|
// Model is the model
|
||||||
type Model struct {
|
type Model struct {
|
||||||
entity.ModelBase
|
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"`
|
Name string `json:"name" gorm:"column:name" filter:"name,string"`
|
||||||
Type string `json:"type" gorm:"column:type" filter:"type,string"`
|
Type string `json:"type" gorm:"column:type" filter:"type,string"`
|
||||||
Template string `json:"template" gorm:"column:template" filter:"template,string"`
|
Template string `json:"template" gorm:"column:template" filter:"template,string"`
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
type Model struct {
|
type Model struct {
|
||||||
entity.ModelBase
|
entity.ModelBase
|
||||||
ExpiresOn types.DBDate `json:"expires_on" gorm:"column:expires_on" filter:"expires_on,integer"`
|
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"`
|
Provider string `json:"provider" gorm:"column:provider" filter:"provider,string"`
|
||||||
Name string `json:"name" gorm:"column:name" filter:"name,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"`
|
DomainNames types.JSONB `json:"domain_names" gorm:"column:domain_names" filter:"domain_names,string"`
|
||||||
|
Loading…
Reference in New Issue
Block a user