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

Method dropIndexIfExists

database/sql/sql.go:691–698  ·  view source on GitHub ↗

dropIndexIfExists drops an index if it exists

(model interface{}, indexName string)

Source from the content-addressed store, hash-verified

689
690// dropIndexIfExists drops an index if it exists
691func (s *sqlDatabase) dropIndexIfExists(model interface{}, indexName string) {
692 if s.conn.Migrator().HasIndex(model, indexName) {
693 if err := s.conn.Migrator().DropIndex(model, indexName); err != nil {
694 slog.With(slog.Any("error", err)).
695 Error(fmt.Sprintf("failed to drop index %s", indexName))
696 }
697 }
698}
699
700// migratePoolNullIDs updates pools to set null IDs instead of zero UUIDs
701func (s *sqlDatabase) migratePoolNullIDs() error {

Callers 1

migrateDBMethod · 0.95

Calls 1

ErrorMethod · 0.45

Tested by

no test coverage detected