Hibernating Rhinos

Zero friction databases

New Option in the RavenDB Studio–Patching

Not long ago we added the option to do Eval Patching in RavenDB (see: http://ayende.com/blog/157185/awesome-ravendb-feature-of-the-day-evil-patching)

Recently we added this option to the studio.

Now when you open the studio you will see a new tab in the options for “Patch”

image

Once there you will see the next screen:

image

 

As you can see this page has many options so lets look at them separately

image

At the top left you have this toolbar with several options, the first one is a combo-box where you can choose what you want to patch (“Document”, “Collection” or “Index”).

Next to it you have the “Test” Option, with this option (which will only be available after selecting a document to check the patch on) when we click on this button the fields on the bottom of the screen (titled “Before Patch” and “After Patch”) will be populated with the selected document and how will it be after we patch.

Next we have the “Save” and “Load” options. With those you can save this page setting and load them again for later use.

Next we have the Patch option that executes the Patch command (this will save the changes to the database)

Let’s look at a small example of patching:

In this case I want to change the Genre name from “Rock” to “Rock and Roll”, after I pressed “Test” I got the screen below, as you can see the “Name” is different.

image

as you can see on the right of the script we have the “Parameters” list, in there I can do this patch in a different way:

image

Now I as you can see we added another value to the document with the help of parameters.

 

Now lets go over the changes when using “Collection”

image

In “Collection” you can see that the “Patch” option changed into 2 options: “Patch Selected” and “Patch All”.

In order to patch only some of the items in the collection you can select then in the “Matching Documents”  section that was added to the page.

Another thing we have is the option to select on which collection we want to patch.

 

And last we have the option to patch by index:

image

In addition to the changes we had for “Collection” we now have a field “Query” for the index and the patch will apply only to the documents that match this query (and the “Matching Documents” will update accordingly).

Comments

Pure Krome
10/22/2012 11:16 PM by
Pure Krome

My spider-sense is telling me that this is awesome stuff :)

love it!

Andreas Kroll
10/28/2012 12:18 PM by
Andreas Kroll

Awesome stuff!

Did you have any thoughts about packing simple patches into a "patch collection" and store that as a file or even as an executable which is able to patch an instance of RavenDB?

That way you could distribute a new version together with its patch file and let either the user execute the patches or have the patch file executed by the update installation of your code.

Thanks Andreas

Christopher Wright
10/28/2012 03:07 PM by
Christopher Wright

Not to complain, but what's going on with the last modified time? Looks like the timezone information is lost (and the last modified time isn't otherwise altered, as it would be if the patch were applied).

Ayende Rahien
10/28/2012 04:52 PM by
Ayende Rahien

Andreas, You are welcome to do any of those. You can do that easily enough, and we have API to support it.

Ayende Rahien
10/28/2012 04:53 PM by
Ayende Rahien

Christopher, Last-Modified wasn't changed because we didn't actually change anything, I hit Test, not Execute, for this screenshot.

Khalid Abuhakmeh
10/29/2012 11:51 AM by
Khalid Abuhakmeh

This is amazing. I can't wait to use it (when I need it).

Chris Marisic
10/30/2012 01:30 PM by
Chris Marisic

This feature addition is really starting to bring RavenDB management experience closer to parity of Sql Server. Addressing this lacking should certainly help for adoption.

It is a somewhat tough sell to a sql user that can do update FOO set Bar = 1 that they need to either write custom code to do it, or queue up curl and post semi-odd requests to the production server with no visibility on what's going to happen.

The test feature of this is just beautiful.

Philip Løventoft
11/25/2012 12:32 PM by
Philip Løventoft

I have been missing this as well. I think it will be extremely useful in production. Thumbs up :)

Comments have been closed on this topic.