Up looks at the currently active migration version and will migrate all the way up (applying all up migrations).
()
| 713 | // Up looks at the currently active migration version |
| 714 | // and will migrate all the way up (applying all up migrations). |
| 715 | func (m *Migrate) Up() error { |
| 716 | var op herrors.Op = "migrate.Migrate.Up" |
| 717 | mode, err := m.databaseDrv.GetSetting("migration_mode") |
| 718 | if err != nil { |
| 719 | return herrors.E(op, err) |
| 720 | } |
| 721 | |
| 722 | if mode != "true" { |
| 723 | return herrors.E(op, ErrNoMigrationMode) |
| 724 | } |
| 725 | |
| 726 | if err := m.lock(); err != nil { |
| 727 | return herrors.E(op, err) |
| 728 | } |
| 729 | |
| 730 | curVersion, dirty, err := m.databaseDrv.Version() |
| 731 | if err != nil { |
| 732 | return herrors.E(op, err) |
| 733 | } |
| 734 | |
| 735 | if dirty { |
| 736 | return herrors.E(op, ErrDirty{curVersion}) |
| 737 | } |
| 738 | |
| 739 | ret := make(chan interface{}, m.PrefetchMigrations) |
| 740 | bar := newProgressBar(applyingMigrationsMessage, m.stderr, m.ProgressBarLogs) |
| 741 | go m.readUp(-1, ret, bar) |
| 742 | |
| 743 | if m.DryRun { |
| 744 | if err := m.unlockErr(m.runDryRun(ret)); err != nil { |
| 745 | return herrors.E(op, err) |
| 746 | } |
| 747 | return nil |
| 748 | } else { |
| 749 | if err := m.unlockErr(m.runMigrations(ret, bar)); err != nil { |
| 750 | return herrors.E(op, err) |
| 751 | } |
| 752 | return nil |
| 753 | } |
| 754 | } |
| 755 | |
| 756 | // Down looks at the currently active migration version |
| 757 | // and will migrate all the way down (applying all down migrations). |
nothing calls this directly
no test coverage detected