Skip to content

Commit

Permalink
remove description from ConnectionHandling
Browse files Browse the repository at this point in the history
  • Loading branch information
davidpeklak committed Jun 13, 2014
1 parent 546a335 commit c70b4e1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 29 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Expand Up @@ -4,7 +4,7 @@ organization := "com.github.davidpeklak"

name := "smt"

version := "0.4e-SNAPSHOT"
version := "0.4f-SNAPSHOT"

publishMavenStyle := false

Expand Down
30 changes: 2 additions & 28 deletions src/main/scala/smt/ConnectionHandling.scala
Expand Up @@ -28,32 +28,6 @@ trait ConnectionHandling[T] extends ConnectionAction[T] {
}
}

def describe(migName: String, dms: DownMoveState, f: String): String = {
"Failed to fully revert migration " + migName + "\n" +
"Applied the following down scripts: \n" +
dms.appliedDowns.mkString("\n") + "\n" +
"The following down script crashed: \n" +
dms.crashedDown.getOrElse("(None)") + "\n" +
"Because of: " + f.toString + "\n" +
"Apply the intended effect of the crashed script manually before continuing."
}

def describe(migName: String, ums: UpMoveState, f: String): String = {
import ums._
val upsWithoutDowns = appliedUpsWithDowns.map(Some(_)).zipAll(appliedUps.map(Some(_)), None, None)
.dropWhile(t => t._1 == t._2).map(_._2.toSeq).flatten

"Failed to fully apply migration " + migName + "\n" +
"Applied the following up scripts: \n" +
ums.appliedUps.mkString("\n") + "\n" +
"The following up script crashed: \n" +
ums.crashedUp.getOrElse("(None)") + "\n" +
"Because of: " + f.toString + "\n" +
"The following up scripts have been applied without recording corresponding down scripts,\n" +
"revert them manually before continuing:" + "\n" +
upsWithoutDowns.map(_.name).mkString("\n")
}

def latestCommon2(mis: Seq[MigrationInfo], ms: Seq[(Migration, Seq[Byte])]): Option[Common] = {
(mis zip ms).takeWhile {
case (MigrationInfo(_, hi, _, _, _), (_, h)) => hi == h
Expand Down Expand Up @@ -116,7 +90,7 @@ trait AddHandling[T] extends AddAction[T] with ConnectionHandling[T] {

liftE(removeDowns(mid.mi.hash) >> remove(mid.mi.hash)) >>
mid.downs.reverse.toList.traverse__(applyScriptAndWrite).recover((dms, f) => {
liftE(rewriteMigration(mid, dms, failHash(f)) >> failure(describe(mid.mi.name, dms, f)))
liftE(rewriteMigration(mid, dms, failHash(f)) >> failure(f))
})
}

Expand Down Expand Up @@ -156,7 +130,7 @@ trait AddHandling[T] extends AddAction[T] with ConnectionHandling[T] {
}

m.groups.toList.traverse__(applyGroup).conclude {
(ums, f) => liftE(finalize(ums.downsToApply, failHash(f)) >> failure(describe(m.name, ums, f)))
(ums, f) => liftE(finalize(ums.downsToApply, failHash(f)) >> failure(f))
} {
(ums, _) => liftE(finalize(ums.downsToApply, hash))
}
Expand Down

0 comments on commit c70b4e1

Please sign in to comment.