Remove unimplemented group code

This commit is contained in:
Manfred Touron 2017-11-02 10:27:58 +01:00
parent 68a8d033b1
commit cf447a84b0

13
db.go
View file

@ -31,14 +31,6 @@ type Host struct {
SSHKey *SSHKey SSHKey *SSHKey
SSHKeyID uint `gorm:"index"` SSHKeyID uint `gorm:"index"`
Fingerprint string // FIXME: replace with hostkey ? Fingerprint string // FIXME: replace with hostkey ?
Groups []Group `gorm:"many2many:host_groups;"`
Comment string
}
type Group struct {
// FIXME: use uuid for ID
gorm.Model
Name string // FIXME: govalidator: min length 3, alphanum
Comment string Comment string
} }
@ -47,7 +39,6 @@ type User struct {
gorm.Model gorm.Model
Name string // FIXME: govalidator: min length 3, alphanum Name string // FIXME: govalidator: min length 3, alphanum
SSHKeys []SSHKey SSHKeys []SSHKey
Groups []Group `gorm:"many2many:user_groups;"`
Comment string Comment string
} }
@ -55,11 +46,9 @@ func dbInit(db *gorm.DB) error {
db.AutoMigrate(&User{}) db.AutoMigrate(&User{})
db.AutoMigrate(&SSHKey{}) db.AutoMigrate(&SSHKey{})
db.AutoMigrate(&Host{}) db.AutoMigrate(&Host{})
db.AutoMigrate(&Group{}) db.Exec(`CREATE UNIQUE INDEX uix_keys_name ON "ssh_keys"("name") WHERE ("deleted_at" IS NULL)`)
db.Exec(`CREATE UNIQUE INDEX uix_keys_name ON "keys"("name") WHERE ("deleted_at" IS NULL)`)
db.Exec(`CREATE UNIQUE INDEX uix_hosts_name ON "hosts"("name") WHERE ("deleted_at" IS NULL)`) db.Exec(`CREATE UNIQUE INDEX uix_hosts_name ON "hosts"("name") WHERE ("deleted_at" IS NULL)`)
db.Exec(`CREATE UNIQUE INDEX uix_users_name ON "users"("name") WHERE ("deleted_at" IS NULL)`) db.Exec(`CREATE UNIQUE INDEX uix_users_name ON "users"("name") WHERE ("deleted_at" IS NULL)`)
db.Exec(`CREATE UNIQUE INDEX uix_groups_name ON "groups"("name") WHERE ("deleted_at" IS NULL)`)
// create default ssh key // create default ssh key
var count uint var count uint