Register a MigrationScript to the Migrator with comment message
(scripts []plugin.MigrationScript, comment string)
| 64 | |
| 65 | // Register a MigrationScript to the Migrator with comment message |
| 66 | func (m *migratorImpl) Register(scripts []plugin.MigrationScript, comment string) { |
| 67 | m.Lock() |
| 68 | defer m.Unlock() |
| 69 | for _, script := range scripts { |
| 70 | scriptId := getScriptId(script.Name(), script.Version()) |
| 71 | swc := &scriptWithComment{ |
| 72 | script: script, |
| 73 | comment: comment, |
| 74 | } |
| 75 | m.scripts = append(m.scripts, swc) |
| 76 | if !m.executed[scriptId] { |
| 77 | m.pending = append(m.pending, swc) |
| 78 | } else { |
| 79 | m.logger.Debug("skipping previously executed migration script: %s", scriptId) |
| 80 | } |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | func (m *migratorImpl) Info(stage string) { |
| 85 | m.logger.Info("[%s] pending scripts: %d, executed scripts: %d, total: %d", stage, len(m.pending), len(m.executed), len(m.scripts)) |
nothing calls this directly
no test coverage detected