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

Support upsert migrations #245

Open
gggeek opened this issue Nov 21, 2020 · 1 comment
Open

Support upsert migrations #245

gggeek opened this issue Nov 21, 2020 · 1 comment
Milestone

Comments

@gggeek
Copy link
Member

gggeek commented Nov 21, 2020

It is currently possible to achieve an upsert (insert-or-update) via a 3-step process:

  • step 1: content/load, match via ..., set reference to count
  • step 2: content/create, if count == 0
  • step 3: content/update, if count == 1, with same match conditions as load

It would be nice to be able to do the same in a single migration step.

Besides contents, upsert could be used for most (all?) other Repo Entities.

NB: there are subtleties involved, such as: what if the pre-existing content has values for fields not specified in the upsert? Or extra locations? Same applies to ContentType defs...

@gggeek
Copy link
Member Author

gggeek commented Oct 12, 2022

A document describing many of the subtleties of upserts for Contents has been added, will be in upcoming release 6.1

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

No branches or pull requests

1 participant