func Migrate(dst, src Transient) error {
	if dstM, ok := dst.(Migrator); ok {
		if srcM, ok := src.(Migrator); ok {
			s := srcM.StateForMigration()
			return dstM.WriteStateForMigration(s, true)
		}
	}
	s := src.State()
	return dst.WriteState(s)
}
Migrate writes the latest transient state snapshot from src into dest,
preserving snapshot metadata (serial and lineage) where possible.

If both managers implement the optional interface Migrator then it will
be used to copy the snapshot and its associated metadata. Otherwise,
the normal Reader and Writer interfaces will be used instead.

If the destination manager refuses the new state or fails to write it then
its error is returned directly.

For state managers that also implement Persistent, it is the caller's
responsibility to persist the newly-written state after a successful result,
just as with calls to Writer.WriteState.

This function doesn't do any locking of its own, so if the state managers
also implement Locker the caller should hold a lock on both managers
for the duration of this call.
package statemgr
import (
	"fmt"
	"github.com/camptocamp/terraboard/internal/terraform/states/statefile"
)
type Migrator interface {
	PersistentMeta
	StateForMigration() *statefile.File
	WriteStateForMigration(f *statefile.File, force bool) error
}