2017-01-05 17:27:56 +00:00
|
|
|
package tables
|
2016-11-18 17:02:51 +00:00
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"database/sql"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func init() {
|
2017-01-05 17:27:56 +00:00
|
|
|
MigrationClient.AddMigration(Up_20161118212515, Down_20161118212515)
|
2016-11-18 17:02:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func Up_20161118212515(tx *sql.Tx) error {
|
|
|
|
|
sqlStatement := "CREATE TABLE `distributed_query_executions` (" +
|
|
|
|
|
"`id` int(10) unsigned NOT NULL AUTO_INCREMENT," +
|
|
|
|
|
"`host_id` int(10) unsigned DEFAULT NULL," +
|
|
|
|
|
"`distributed_query_campaign_id` int(10) unsigned DEFAULT NULL," +
|
|
|
|
|
"`status` int(11) DEFAULT NULL," +
|
|
|
|
|
"`error` varchar(1024) DEFAULT NULL," +
|
|
|
|
|
"`execution_duration` bigint(20) DEFAULT NULL," +
|
2016-11-23 00:35:43 +00:00
|
|
|
"UNIQUE KEY `idx_dqe_unique_host_dqc_id` (`host_id`, `distributed_query_campaign_id`)," +
|
2016-11-18 17:02:51 +00:00
|
|
|
"PRIMARY KEY (`id`)" +
|
|
|
|
|
") ENGINE=InnoDB DEFAULT CHARSET=utf8;"
|
|
|
|
|
_, err := tx.Exec(sqlStatement)
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func Down_20161118212515(tx *sql.Tx) error {
|
|
|
|
|
_, err := tx.Exec("DROP TABLE IF EXISTS `distributed_query_executions`;")
|
|
|
|
|
return err
|
|
|
|
|
}
|