
Drafts migration tools
Some internal tooling to make sure the transition to drafts is smooth
Transcript
This transcript is auto-generated. Names and product terms may be wrong.
do a little one um I ended up spending most of hack week working on drafts sorry cat is helping um but one piece of drafts I wanted to do was start cleaning up um killing off some W code um and so built a little tool to do so-called live migrations basically right now the only kind of migrations we run generally speaking are ones we either do uh database migrations where which are run deploy we basically like alter the the database or run some SQL um or we do just in time so like you open a document we do something something to it so right that's how we're doing the draft publishing right now but at some point we want to be able to get rid
of all the code for doing those migrations and just say everybody's got the new fancy thing and we can delete all the old code and stop thinking about those existing um so this is just a ability to run in process so in the node process run some J node function a whole bunch of times if we want to um so I built a little UI for it because I think it's something we'll use again again um and this one is built out so publishing workflow for documents um so basically it will work either single organization or or all organizations on the region um this is my local so there's like there's two organizations but the other doesn't have anything in it um it gives you
a little slice of data it's going to use um and then you do have to enter the number of records that you think you're altering and and organizations you're doing multi organization apply it to them um this is written somewhat uh optimistically let's say in that uh if we run out of time in the Noe process which is 60 seconds um it'll just die which is fine um and you'll run it again and do the rest of the records um in my bit of testing we should be able to do thousands on some of these um but it'll let us migrate out old data um so we'll use this to like deprecate the old workbook URLs probably um other stuff like that so we can
start cleaning out old code um so also let us do things like evolve the dashboard layout uh Json blobs um and then stop supporting the old one so it's a little Tool uh I guess because this is actually mostly code um defining a new one is basically just one of these little blocks um and then uh the migration itself is actually just a where I put it sorry um this is a migration so basically you configure it in that little config block which says like the name and descript stuff and you say get which says which records to get and migrate which runs over those records and does something in my case it does it's calling the exact same function we use for just in
time to initialize publishing so yeah it should be a pretty common pattern where we deploy a new version we do just in time migration for a while and then you we want to eventually bulk apply it so we can deprecate code so little pattern for that