Add --only-preserve-backend flag to lamdera check#93
Add --only-preserve-backend flag to lamdera check#93MavenRain wants to merge 1 commit intolamdera:lamdera-nextfrom
Conversation
When set, the generated migration file uses ModelUnchanged/MsgUnchanged for all types except BackendModel, which gets the normal auto-generated migration. Useful when iterating on frontend types without caring about their migration continuity. Fixes lamdera#66.
| migrationModuleText = T.concat ["Evergreen.Migrate.V", show_ newVersion] | ||
|
|
||
| typeDidChange t oldHash newHash = | ||
| oldHash /= newHash && not (onlyPreserveBackend && t /= N.fromChars "BackendModel") |
There was a problem hiding this comment.
We probably also want BackendMsg here?
There was a problem hiding this comment.
This is true only if we have scheduled things right?
There was a problem hiding this comment.
There is no scheduling dependency here. coreTypeDiffs always contains all six core types (from Lamdera.Types.core), built via a zipWith3 in Check.hs. Every type flows through generateFor; the predicate is evaluated per-type. When onlyPreserveBackend is True, any type that isn't BackendModel evaluates to False regardless of the hashes, which causes coreTypeMigration to emit the Unchanged wrapper (line 194). The flag is purely a filter on which hash comparisons matter, not on what gets processed.
There was a problem hiding this comment.
FYI, my question was to @miniBill comment "We probably also want BackendMsg here?"
When set, the generated migration file uses ModelUnchanged/MsgUnchanged for all types except BackendModel, which gets the normal auto-generated migration. Useful when iterating on frontend types without caring about their migration continuity. Fixes #66.