MCPcopy Index your code
hub / github.com/coder/coder / checkMigrateVersion

Function checkMigrateVersion

scripts/migrate-test/main.go:148–160  ·  view source on GitHub ↗
(conn *sql.DB)

Source from the content-addressed store, hash-verified

146}
147
148func checkMigrateVersion(conn *sql.DB) (int, error) {
149 var version int
150 rows, err := conn.Query(`SELECT version FROM schema_migrations LIMIT 1;`)
151 if err != nil {
152 return -1, nil // not migrated
153 }
154 for rows.Next() {
155 if err := rows.Scan(&version); err != nil {
156 return 0, xerrors.Errorf("scan version: %w", err)
157 }
158 }
159 return version, nil
160}

Callers 1

mainFunction · 0.85

Calls 3

NextMethod · 0.65
ScanMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected