Create a new Fleet database migration with timestamp naming, Up function, init registration, and test file.
Instalação
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
package tables
import (
"testing""github.com/stretchr/testify/require"
)
funcTestUp_{TIMESTAMP}(t *testing.T) {
db := applyUpToPrev(t)
// Set up test data before migration if needed
applyNext(t, db)
// Verify migration applied correctly// e.g., check table exists, columns added, data migrated
}
4. Verify
Run go build ./server/datastore/mysql/migrations/... to check compilation
Run MYSQL_TEST=1 go test -run TestUp_{TIMESTAMP} ./server/datastore/mysql/migrations/tables/ to test the migration
Rules
Every migration MUST have a test file
Down migrations are always no-ops (return nil) — Fleet doesn't use rollback migrations
Never modify existing migration files — create new ones