Skip to content

Add --only-preserve-backend flag to lamdera check#93

Open
MavenRain wants to merge 1 commit intolamdera:lamdera-nextfrom
MavenRain:feat/check-only-backend
Open

Add --only-preserve-backend flag to lamdera check#93
MavenRain wants to merge 1 commit intolamdera:lamdera-nextfrom
MavenRain:feat/check-only-backend

Conversation

@MavenRain
Copy link
Copy Markdown

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.

  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")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably also want BackendMsg here?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is true only if we have scheduled things right?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, my question was to @miniBill comment "We probably also want BackendMsg here?"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: lamdera check --only-preserve-backend

3 participants