Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion extra/Lamdera/CLI/Backend.hs
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,7 @@ addBackendModelDecl base64 =
\ >> nextChunk []\n\
\ )\n\
\ |>Lamdera.Wire3.intListToBytes\n\
\ |>Lamdera.Wire3.bytesDecode Types.w3_decode_BackendModel\n\
\ |>Lamdera.Wire3.bytesDecode Types.w3_unsafe_decode_BackendModel\n\
\ |>(\\maybeModel ->\n\
\ case maybeModel of\n\
\ Just m -> m\n\
Expand Down
22 changes: 11 additions & 11 deletions extra/Lamdera/Evergreen/MigrationHarness.hs
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,14 @@ decodeAndUpgradeFor migrationSequence nextVersion valueType = do
if valueType == "BackendModel" then
[text|
$nextVersion_ ->
decodeType $valueTypeInt version bytes T$nextVersion_.w3_decode_$valueType
decodeType $valueTypeInt version bytes T$nextVersion_.w3_unsafe_decode_$valueType
|> upgradeIsCurrent
|> otherwiseError
|]
else
[text|
$nextVersion_ ->
decodeType $valueTypeInt version bytes T$nextVersion_.w3_decode_$valueType
decodeType $valueTypeInt version bytes T$nextVersion_.w3_unsafe_decode_$valueType
|> upgradeIsCurrent
|> otherwiseError
|]
Expand Down Expand Up @@ -308,13 +308,13 @@ migrationForType migrationSequence migrationsForVersion startVersion finalVersio
if tipe == "BackendModel"
then
[text|
decodeType $valueTypeInt $finalVersion_ bytes T$finalVersion_.w3_decode_$tipe
decodeType $valueTypeInt $finalVersion_ bytes T$finalVersion_.w3_unsafe_decode_$tipe
|> upgradeSucceeds
|> otherwiseError
|]
else
[text|
decodeType $valueTypeInt $finalVersion_ bytes T$finalVersion_.w3_decode_$tipe
decodeType $valueTypeInt $finalVersion_ bytes T$finalVersion_.w3_unsafe_decode_$tipe
|> upgradeSucceeds
|> otherwiseError
|]
Expand All @@ -323,14 +323,14 @@ migrationForType migrationSequence migrationsForVersion startVersion finalVersio
if tipe == "BackendModel"
then
[text|
decodeType $valueTypeInt $startVersion_ bytes T$startVersion_.w3_decode_$tipe
decodeType $valueTypeInt $startVersion_ bytes T$startVersion_.w3_unsafe_decode_$tipe
$intermediateMigrationsFormatted
|> upgradeSucceeds
|> otherwiseError
|]
else
[text|
decodeType $valueTypeInt $startVersion_ bytes T$startVersion_.w3_decode_$tipe
decodeType $valueTypeInt $startVersion_ bytes T$startVersion_.w3_unsafe_decode_$tipe
$intermediateMigrationsFormatted
|> upgradeSucceeds
|> otherwiseError
Expand Down Expand Up @@ -397,16 +397,16 @@ intermediateMigration allMigrations tipe from to finalVersion =
migrationFn = [text|M$to_.$typenameCamel|]
in
[text|
|> $thenMigrateForType $valueTypeInt $migrationFn T$from_.w3_encode_$tipe T$to_.w3_decode_$tipe $to_
|> $thenMigrateForType $valueTypeInt $migrationFn T$from_.w3_encode_$tipe T$to_.w3_unsafe_decode_$tipe $to_
|]

WithoutMigrations v ->
{- It might seem like this is uneeded, but it's for when there's a migration in our chain, yet
the last version has no migrations. I.e.:

decodeType "BackendModel" 1 intList T1.w3_decode_BackendModel
|> thenMigrateModel "BackendModel" M2.backendModel T1.w3_encode_BackendModel T2.w3_decode_BackendModel 2
|> thenMigrateModel "BackendModel" (always ModelUnchanged) T2.w3_encode_BackendModel T3.w3_decode_BackendModel 3
decodeType "BackendModel" 1 intList T1.w3_unsafe_decode_BackendModel
|> thenMigrateModel "BackendModel" M2.backendModel T1.w3_encode_BackendModel T2.w3_unsafe_decode_BackendModel 2
|> thenMigrateModel "BackendModel" (always ModelUnchanged) T2.w3_encode_BackendModel T3.w3_unsafe_decode_BackendModel 3
|> upgradeSucceeds CurrentBackendModel
|> otherwiseError

Expand All @@ -416,7 +416,7 @@ intermediateMigration allMigrations tipe from to finalVersion =
migrationFn = "(always " <> kindForType <> "Unchanged)"
in
[text|
|> $thenMigrateForType $valueTypeInt $migrationFn T$from_.w3_encode_$tipe T$to_.w3_decode_$tipe $to_
|> $thenMigrateForType $valueTypeInt $migrationFn T$from_.w3_encode_$tipe T$to_.w3_unsafe_decode_$tipe $to_
|]


Expand Down
Loading
Loading