Merge pull request #303 from kradalby/migrate_ipaddresses

This commit is contained in:
Kristoffer Dalby 2022-01-31 08:57:22 +00:00 committed by GitHub
commit e05c5e0b93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

8
db.go
View File

@ -28,20 +28,26 @@ func (h *Headscale) initDB() error {
h.db = db
if h.dbType == Postgres {
db.Exec("create extension if not exists \"uuid-ossp\";")
db.Exec(`create extension if not exists "uuid-ossp";`)
}
_ = db.Migrator().RenameColumn(&Machine{}, "ip_address", "ip_addresses")
err = db.AutoMigrate(&Machine{})
if err != nil {
return err
}
err = db.AutoMigrate(&KV{})
if err != nil {
return err
}
err = db.AutoMigrate(&Namespace{})
if err != nil {
return err
}
err = db.AutoMigrate(&PreAuthKey{})
if err != nil {
return err