Skip to content

Commit

Permalink
Review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
istreeter committed Nov 22, 2024
1 parent 052450f commit 31a6e19
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ object Migrations {
}

// Comparing struct target fields to the source. This will detect additions.
val reverseMigration = targetFields.map(tgtField => MigrationFieldPair(tgtField.name :: path, tgtField, sourceStruct.focus(tgtField.name)).migrations)
val reverseMigration = targetFields.map {
tgtField =>
MigrationFieldPair(tgtField.name :: path, tgtField, sourceStruct.focus(tgtField.name)).migrations
}

migrations ++= forwardMigration.iterator.flatMap(_.migrations)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -526,31 +526,31 @@ class MigrationSpec extends org.specs2.Specification {
def e17 = {
val struct1 = Type.Struct(
NonEmptyVector.of(
Field("zzz", Type.String, Nullable),
Field("yyy", Type.String, Nullable),
Field("vvv", Type.String, Nullable),
Field("xxx", Type.String, Nullable),
Field("zzz", Type.String, Nullable),
)
)

val struct2 = Type.Struct(
NonEmptyVector.of(
Field("vvv", Type.String, Required),
Field("www", Type.String, Required),
Field("xxx", Type.String, Required),
Field("new1", Type.String, Required),
Field("yyy", Type.String, Required),
Field("new2", Type.String, Required),
Field("zzz", Type.String, Required),
)
)

val expectedStruct = Type.Struct(
NonEmptyVector.of(
// original fields
Field("zzz", Type.String, Nullable),
Field("yyy", Type.String, Nullable),
Field("vvv", Type.String, Nullable),
Field("xxx", Type.String, Nullable),
Field("zzz", Type.String, Nullable),
// added fields
Field("new1", Type.String, Nullable),
Field("new2", Type.String, Nullable),
Field("www", Type.String, Nullable),
Field("yyy", Type.String, Nullable),
)
)

Expand Down

0 comments on commit 31a6e19

Please sign in to comment.