Coder Social home page Coder Social logo

Comments (2)

mfridman avatar mfridman commented on June 11, 2024

Yes you're right, we had a check for this exact case in the methods themselves. I was really hoping to optimize this, but it looks like we still have to list all migrations even in the allow missing (out-of-order) case.

goose/provider_run.go

Lines 40 to 64 in 7e6240d

// feat(mf): It is very possible someone may want to apply ONLY new migrations and skip missing
// migrations entirely. At the moment this is not supported, but leaving this comment because
// that's where that logic would be handled.
//
// For example, if db has 1,4 applied and 2,3,5 are new, we would apply only 5 and skip 2,3. Not
// sure if this is a common use case, but it's possible.
if len(missingMigrations) > 0 && !p.cfg.allowMissing {
var collected []string
for _, v := range missingMigrations {
collected = append(collected, strconv.FormatInt(v, 10))
}
msg := "migration"
if len(collected) > 1 {
msg += "s"
}
var versionsMsg string
if len(collected) > 1 {
versionsMsg = "versions " + strings.Join(collected, ",")
} else {
versionsMsg = "version " + collected[0]
}
return nil, fmt.Errorf("found %d missing (out-of-order) %s lower than current max (%d): %s",
len(missingMigrations), msg, dbMaxVersion, versionsMsg,
)
}

from goose.

mfridman avatar mfridman commented on June 11, 2024

Alright, #762 should fix that issue. It effectively calls the same method the internal up methods call, which handles the allowed missing (out-of-order) logic.

I also updated the test to make sure we captured this behavior.

One thing remaining is to think through the behavior of CheckPending, #762 (comment)

from goose.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.