fleet/server/datastore/mysql/migrations/tables/20171116163618_CreateTableOsqueryOptions.go
Zachary Wasserman 5e9fe9d5a1
Transition osquery options interfaces for compatibility with fleetctl (#1649)
- Refinements to options yaml definition
- Datastore and service implementations
- Migration to bring existing options into new table format
2017-12-13 18:14:54 -05:00

25 lines
645 B
Go

package tables
import "database/sql"
func init() {
MigrationClient.AddMigration(Up_20171116163618, Down_20171116163618)
}
func Up_20171116163618(tx *sql.Tx) error {
sqlStatement := "CREATE TABLE `osquery_options` (" +
"`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT," +
"`override_type` INT(1) NOT NULL, " +
"`override_identifier` VARCHAR(255) NOT NULL DEFAULT ''," +
"`options` JSON NOT NULL," +
"PRIMARY KEY (`id`)" +
") ENGINE=InnoDB DEFAULT CHARSET=utf8;"
_, err := tx.Exec(sqlStatement)
return err
}
func Down_20171116163618(tx *sql.Tx) error {
_, err := tx.Exec("DROP TABLE IF EXISTS `osquery_options`;")
return err
}