MCPcopy Create free account
hub / github.com/cloudbase/garm / migrateGithubEndpointType

Method migrateGithubEndpointType

database/sql/sql.go:725–743  ·  view source on GitHub ↗

migrateGithubEndpointType adds and initializes endpoint_type column

()

Source from the content-addressed store, hash-verified

723
724// migrateGithubEndpointType adds and initializes endpoint_type column
725func (s *sqlDatabase) migrateGithubEndpointType() error {
726 if !s.conn.Migrator().HasTable(&GithubEndpoint{}) {
727 return nil
728 }
729
730 if s.conn.Migrator().HasColumn(&GithubEndpoint{}, "endpoint_type") {
731 return nil
732 }
733
734 if err := s.conn.Migrator().AutoMigrate(&GithubEndpoint{}); err != nil {
735 return fmt.Errorf("error migrating github endpoints: %w", err)
736 }
737
738 if err := s.conn.Exec("update github_endpoints set endpoint_type = 'github' where endpoint_type is null").Error; err != nil {
739 return fmt.Errorf("error updating github endpoints: %w", err)
740 }
741
742 return nil
743}
744
745// migrateControllerInfo updates controller info with new fields
746func (s *sqlDatabase) migrateControllerInfo(hasMinAgeField, hasAgentURL bool) error {

Callers 1

migrateDBMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected