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

Method preMigrationChecks

database/sql/sql.go:780–795  ·  view source on GitHub ↗

preMigrationChecks performs checks before running migrations

()

Source from the content-addressed store, hash-verified

778
779// preMigrationChecks performs checks before running migrations
780func (s *sqlDatabase) preMigrationChecks() (needsCredentialMigration, migrateTemplates, hasMinAgeField, hasAgentURL bool) {
781 // Check if credentials need migration
782 needsCredentialMigration = !s.conn.Migrator().HasTable(&GithubCredentials{}) ||
783 !s.conn.Migrator().HasTable(&GithubEndpoint{})
784
785 // Check if templates need migration
786 migrateTemplates = !s.conn.Migrator().HasTable(&Template{})
787
788 // Check for controller info fields
789 if s.conn.Migrator().HasTable(&ControllerInfo{}) {
790 hasMinAgeField = s.conn.Migrator().HasColumn(&ControllerInfo{}, "minimum_job_age_backoff")
791 hasAgentURL = s.conn.Migrator().HasColumn(&ControllerInfo{}, "agent_url")
792 }
793
794 return
795}
796
797func (s *sqlDatabase) migrateDB() error {
798 // Drop obsolete indexes

Callers 1

migrateDBMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected