Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(mm): yaml migration fixup #5913

Merged
merged 1 commit into from
Mar 9, 2024

Conversation

psychedelicious
Copy link
Collaborator

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update
  • Community Node Submission

Description

  • If the metadata yaml has an invalid version, exist the app. If we don't, the app will crawl the models dir and add models to the db without having first parsed models.yaml. This should not happen often, as the vast majority of users are on v3.0.0 models.yaml files.
  • Fix off-by-one error with models count (need to pop the __metadata__ stanza
  • After a successful migration, rename models.yaml to models.yaml.bak to prevent the migration logic from re-running on subsequent app startups.

QA Instructions, Screenshots, Recordings

With a v3.X.Y models.yaml and database:

  • Make backups of your models.yaml and db
  • Run the app from this PR, all models should migrate successfully and show up in the app
  • models.yaml should have been renamed models.yaml.bak
  • Restart the app, it should not show any model migration messages

Restore the backed-up yaml and db, then:

  • Edit models.yaml, changing the version or removing the __metadata__ stanza
  • Start the app, it should error out during startup, preventing any changes from being made to the db

Merge Plan

This PR can be merged when approved

- If the metadata yaml has an invalid version, exist the app. If we don't, the app will crawl the models dir and add models to the db without having first parsed `models.yaml`. This should not happen often, as the vast majority of users are on v3.0.0 models.yaml files.
- Fix off-by-one error with models count (need to pop the `__metadata__` stanza
- After a successful migration, rename `models.yaml` to `models.yaml.bak` to prevent the migration logic from re-running on subsequent app startups.
@github-actions github-actions bot added python PRs that change python files services PRs that change app services labels Mar 9, 2024
@hipsterusername hipsterusername merged commit d4686b7 into main Mar 9, 2024
14 checks passed
@hipsterusername hipsterusername deleted the psyche/fix/models-yaml-migration branch March 9, 2024 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python PRs that change python files services PRs that change app services
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants