Skip to content

Load existing modeled methods before saving, to avoid overwriting data#2621

Merged
robertbrignull merged 4 commits intomainfrom
robertbrignull/data-saving
Jul 20, 2023
Merged

Load existing modeled methods before saving, to avoid overwriting data#2621
robertbrignull merged 4 commits intomainfrom
robertbrignull/data-saving

Conversation

@robertbrignull
Copy link
Copy Markdown
Contributor

@robertbrignull robertbrignull commented Jul 19, 2023

The idea of this PR is to avoid the possibility of losing data when writing data extension YAML files. We read the modeled methods in and then merge the existing contents with the new contents. As you can see from the tests, the behaviour when there are no existing modeled methods is the same, and there are new tests for when there are existing modeled methods.

The feature that's pushing us to implement this is to allow saving only some of the modeled methods from a model at a time. This will be necessary to support framework mode where we want to only save methods from a single package.

I've tested this locally and I believe it's doing the right thing. If I modify or add a new model file while the extensions editor is open, it will not delete the new file and any changes will be merged into the existing content. Framework mode doesn't quite work fully yet so I can't test it there, but implementing framework mode fully is the next thing I will look at.

Checklist

  • CHANGELOG.md has been updated to incorporate all user visible changes made by this pull request.
  • Issues have been created for any UI or other user-facing changes made by this pull request.
  • [Maintainers only] If this pull request makes user-facing changes that require documentation changes, open a corresponding docs pull request in the github/codeql repo and add the ready-for-doc-review label there.

@robertbrignull robertbrignull requested a review from a team as a code owner July 19, 2023 10:55
@robertbrignull
Copy link
Copy Markdown
Contributor Author

I realise this is a bit of a change to behaviour. I could try to get the framework mode PR up so you can see how this new behaviour will be used.

@robertbrignull
Copy link
Copy Markdown
Contributor Author

Actually, framework mode, by clicking "switch mode" is working pretty well with this PR and saving individual sections is working as intended.

Copy link
Copy Markdown
Member

@koesie10 koesie10 left a comment

Choose a reason for hiding this comment

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

These changes make sense to me

Comment thread extensions/ql-vscode/src/data-extensions-editor/yaml.ts
@robertbrignull robertbrignull enabled auto-merge July 19, 2023 15:22
@robertbrignull robertbrignull merged commit d8687b5 into main Jul 20, 2023
@robertbrignull robertbrignull deleted the robertbrignull/data-saving branch July 20, 2023 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants