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

Method loadExecuted

backend/core/migration/migrator.go:44–63  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

42}
43
44func (m *migratorImpl) loadExecuted() errors.Error {
45 db := m.basicRes.GetDal()
46 // make sure migration_history table exists
47 err := db.AutoMigrate(&MigrationHistory{})
48 if err != nil {
49 return errors.Default.Wrap(err, "error performing migrations")
50 }
51 // load executed scripts into memory
52 m.executed = make(map[string]bool)
53 var records []MigrationHistory
54 err = db.All(&records)
55 if err != nil {
56 return errors.Default.Wrap(err, "error finding migration history records")
57 }
58 for _, record := range records {
59 scriptId := getScriptId(record.ScriptName, record.ScriptVersion)
60 m.executed[scriptId] = true
61 }
62 return nil
63}
64
65// Register a MigrationScript to the Migrator with comment message
66func (m *migratorImpl) Register(scripts []plugin.MigrationScript, comment string) {

Callers 1

NewMigratorFunction · 0.95

Calls 5

getScriptIdFunction · 0.85
WrapMethod · 0.80
GetDalMethod · 0.65
AutoMigrateMethod · 0.65
AllMethod · 0.65

Tested by

no test coverage detected