MCPcopy
hub / github.com/rubenv/sql-migrate / ToCatchup

Function ToCatchup

migrate.go:800–819  ·  view source on GitHub ↗
(migrations, existingMigrations []*Migration, lastRun *Migration)

Source from the content-addressed store, hash-verified

798}
799
800func ToCatchup(migrations, existingMigrations []*Migration, lastRun *Migration) []*PlannedMigration {
801 missing := make([]*PlannedMigration, 0)
802 for _, migration := range migrations {
803 found := false
804 for _, existing := range existingMigrations {
805 if existing.Id == migration.Id {
806 found = true
807 break
808 }
809 }
810 if !found && migration.Less(lastRun) {
811 missing = append(missing, &PlannedMigration{
812 Migration: migration,
813 Queries: migration.Up,
814 DisableTransaction: migration.DisableTransactionUp,
815 })
816 }
817 }
818 return missing
819}
820
821func GetMigrationRecords(db *sql.DB, dialect string) ([]*MigrationRecord, error) {
822 return migSet.GetMigrationRecords(db, dialect)

Callers 1

planMigrationCommonMethod · 0.85

Calls 1

LessMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…