fleet/server/datastore/mysql/migrations/tables/20211109121546_AddShellToUsers.go
Tomas Touceda 887e42650b
Further optimize host select with policies (#3013)
* Further optimize host select with policies

* Add missing row close

* Improve migration

* Skip migration if column already exists

* Add test for host with/without extras
2021-11-18 14:36:35 -03:00

21 lines
396 B
Go

package tables
import (
"database/sql"
)
func init() {
MigrationClient.AddMigration(Up_20211109121546, Down_20211109121546)
}
func Up_20211109121546(tx *sql.Tx) error {
if columnExists(tx, "host_users", "shell") {
return nil
}
_, err := tx.Exec(`ALTER TABLE host_users ADD COLUMN shell varchar(255) DEFAULT ''`)
return err
}
func Down_20211109121546(tx *sql.Tx) error {
return nil
}