Files
fleet/server/datastore/mysql/migrations/tables/20260108200708_AddHostLocationSupport.go
T
9f29fd1ce9 33509 feature branch (#38038)
<!-- Add the related story/sub-task/bug number, like Resolves #123, or
remove if NA -->
**Related issue:** Resolves #33509

All changes were approved in PRs to this feature branch.

---------

Co-authored-by: RachelElysia <71795832+RachelElysia@users.noreply.github.com>
Co-authored-by: Ian Littman <iansltx@gmail.com>
Co-authored-by: jacobshandling <61553566+jacobshandling@users.noreply.github.com>
Co-authored-by: George Karr <georgekarrv@users.noreply.github.com>
2026-01-08 16:37:46 -05:00

32 lines
735 B
Go

package tables
import (
"database/sql"
"fmt"
)
func init() {
MigrationClient.AddMigration(Up_20260108200708, Down_20260108200708)
}
func Up_20260108200708(tx *sql.Tx) error {
_, err := tx.Exec(`
CREATE TABLE host_last_known_locations (
host_id INT UNSIGNED NOT NULL,
latitude DECIMAL(10, 8),
longitude DECIMAL(11, 8),
created_at timestamp(6) DEFAULT CURRENT_TIMESTAMP(6),
updated_at timestamp(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
PRIMARY KEY (host_id)
) DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci`)
if err != nil {
return fmt.Errorf("failed to create table host_last_known_locations: %w", err)
}
return nil
}
func Down_20260108200708(tx *sql.Tx) error {
return nil
}