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

Function Down

coderd/database/migrations/migrate.go:152–169  ·  view source on GitHub ↗

Down runs all down SQL migrations.

(db *sql.DB)

Source from the content-addressed store, hash-verified

150
151// Down runs all down SQL migrations.
152func Down(db *sql.DB) error {
153 _, m, err := setup(db, migrations)
154 if err != nil {
155 return xerrors.Errorf("migrate setup: %w", err)
156 }
157
158 err = m.Down()
159 if err != nil {
160 if errors.Is(err, migrate.ErrNoChange) {
161 // It's OK if no changes happened!
162 return nil
163 }
164
165 return xerrors.Errorf("down: %w", err)
166 }
167
168 return nil
169}
170
171// EnsureClean checks whether all migrations for the current version have been
172// applied, without making any changes to the database. If not, returns a

Callers 2

TestMigrateFunction · 0.92

Calls 3

setupFunction · 0.70
ErrorfMethod · 0.45
IsMethod · 0.45

Tested by 2

TestMigrateFunction · 0.74