MCPcopy
hub / github.com/apache/devlake / Register

Method Register

backend/core/migration/migrator.go:66–82  ·  view source on GitHub ↗

Register a MigrationScript to the Migrator with comment message

(scripts []plugin.MigrationScript, comment string)

Source from the content-addressed store, hash-verified

64
65// Register a MigrationScript to the Migrator with comment message
66func (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
84func (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))

Callers

nothing calls this directly

Calls 4

getScriptIdFunction · 0.85
NameMethod · 0.65
VersionMethod · 0.65
DebugMethod · 0.65

Tested by

no test coverage detected