uSync-Legacy icon indicating copy to clipboard operation
uSync-Legacy copied to clipboard

Exclusive Imports

Open KevinJump opened this issue 9 years ago • 7 comments

From : https://github.com/KevinJump/jumps.umbraco.usync/issues/64

Here is an idea I would like, as an option: Exclusive import.

We are working with branches, and we need a way to clear data from the database, if it is not part of the current branch. The exclusive import would be a complete import, but it would also delete things that are not on disk.

Usecase:

  1. I work on feature A, where I am doing some major restructuring in my document-types. This works just fine, as long as I stay on branch A.
  2. My colleague asks me to help with something on feature B on branch B, so I switch branch.
  3. Because the import will only import document-types on branch B, all my changes from Branch A will still be in the database.
  4. I would press "Exclusive import", and uSync would basically delete everything from the database, and import everything from disk.

Right now my workaround is to delete the entire database, add a clean database from a script I have, and do an import using uSync.

KevinJump avatar Sep 02 '16 16:09 KevinJump

yes - would be nice to have this as a setting inside the config, sort of strict match,

KevinJump avatar Sep 02 '16 16:09 KevinJump

This could also be done outside of the core usync now, without needing to build it in.

  • You could attach to the usync events that fire when it has ran
  • then you could run a full export of the existing site to another location on disk
  • you could then compare the usync folder with this new export and get teh diffrences
  • anything in the export not in the import could be added to your own usyncaction file as a delete
  • you could then fire the action file through as an import (folder path pointing to a single location with your action file in it).
  • all the things would get deleted.

this would work and most of the code to do the compares and custom imports lives inside usync.snapshots.

KevinJump avatar Sep 02 '16 16:09 KevinJump

in terms of core it does need to be optional, deleting a document type inside umbraco will also delete any content associated with that doctype, so a full match sync could destroy quite a lot of stuff if you didn't know what you where doing..

KevinJump avatar Sep 02 '16 16:09 KevinJump

Need to remember to do content edition too .

KevinJump avatar Oct 28 '16 21:10 KevinJump

Having thought about this - it's a potentially dangerous change to just pop in to the main app - I am going to move it to its own dll , and have an add on if anyone wants to do this.

KevinJump avatar Nov 05 '16 18:11 KevinJump

Hi, is this available in a separate dll anywhere?

We would really like this, mainly for the branching reason you've outlined, but also as a dev's local copy could become out of date if they don't work on a project for a while and we've cleaned up any delete files.

The workflow we're trying to get to (which uSync is very, very close to giving us!) is:

  • Devs work on local db, use usync to check in their "DB code" changes (doc types etc.) and also technical content/media to prove configurability, etc.
  • Use of a gitflow process with pull requests onto develop, so ability to switch feature branches quickly+easily (needs this feature ideally)
  • Check in triggers a CI process which builds + (if develop branch) deploys to dev: current plan is to use entirely separate uSync config on server environments to stop any import/export, and have e.g. a console app run only on actual deployment (so restarts etc. can't trigger uSync to do anything)
  • Same for releasing to higher environments, except we would ditch technical content import in staging/prod.

So in other words we'd basically like to have local machines as aggressive as possible against local dbs (as source control should be king), but then use entirely different setup for all server environments that only imports from source control, and only runs on deployment.

Thanks!

david-richards avatar May 22 '17 09:05 david-richards

hi, not at the moment, I think the code is half in a branch somewhere. but it hasn't been brought into what will be the explicit sync project here:. https://github.com/KevinJump/uSync/tree/Dev-v7_4/Jumoo.uSync.ExplicitSync

If i get some time its on my list and hopefully it's a simple enough idea but as the comment says - get this wrong and you're umbraco install will go awol.

KevinJump avatar May 22 '17 13:05 KevinJump