mirror of
https://github.com/moul/sshportal.git
synced 2025-09-08 21:55:56 +08:00
Add missing DB migration for Host.Name
Commit 44559f0
("fix: increase size of name fields") changed the size of
the `Host.Name` DB field but did not add a migration.
This commit is contained in:
parent
34d6b52211
commit
8ffc0653fb
1 changed files with 22 additions and 0 deletions
|
@ -536,6 +536,28 @@ func DBInit(db *gorm.DB) error {
|
|||
return tx.AutoMigrate(&ACL{})
|
||||
},
|
||||
Rollback: func(tx *gorm.DB) error { return fmt.Errorf("not implemented") },
|
||||
}, {
|
||||
ID: "33",
|
||||
Migrate: func(tx *gorm.DB) error {
|
||||
type Host struct {
|
||||
gorm.Model
|
||||
Name string `gorm:"index:uix_hosts_name,unique;type:varchar(255)" valid:"required,length(1|255)"`
|
||||
Addr string
|
||||
User string
|
||||
Password string
|
||||
URL string
|
||||
SSHKey *dbmodels.SSHKey `gorm:"ForeignKey:SSHKeyID"`
|
||||
SSHKeyID uint `gorm:"index"`
|
||||
HostKey []byte `sql:"size:10000"`
|
||||
Groups []*dbmodels.HostGroup `gorm:"many2many:host_host_groups;"`
|
||||
Comment string
|
||||
Hop *dbmodels.Host
|
||||
Logging string
|
||||
HopID uint
|
||||
}
|
||||
return tx.AutoMigrate(&Host{})
|
||||
},
|
||||
Rollback: func(tx *gorm.DB) error { return fmt.Errorf("not implemented") },
|
||||
},
|
||||
})
|
||||
if err := m.Migrate(); err != nil {
|
||||
|
|
Loading…
Add table
Reference in a new issue