How to do a data upgrade with a workflow

To all,

We are embarking on a significant upgrade to our app that will require us to upgrade existing user data into an updated data schema. Mostly, this is populating the new columns in the existing columns based on some row logic, before we remove the old columns later.

It would seem a workflow would be the ticket here. I haven’t found anyone calling out this specific scenario in docs or blogs.

Suggestions and examples on how to do this? Best practices? Specific magic incantations?

Thanks!

I didn’t quite catch that
Do you mean you want to conditionally restructure a DB table?

No, I need to transition data already in the table to new columns. For example, one of my columns was User Type but now will be a Resource type, etc.

I’d first make sure these new columns are set on the data type in question.

Then I’d create a backend WF to take a thing of this type as the input and populate the new columns based on the input thing’s value + your logic.

Then go to App Data and open this data type’s view, then hit Bulk → select your backend WF → run on as many entries as you need.
Bubble does it’s magic on the selected things and it will be updated on the DB

Do a test run of this backend WF on a few things first - before running it in bulk on all your data.

It depends entirely on the complexity of what you’re trying to do….

But most likely, a series of recursive workflows will be what you need…

The first one will iterate over a list of things as many times as necessary, then once it’s complete it can kick off the next workflow to do the same, and so on.

If I were you, I’d record the process in a ‘log’ data type, so you know where it’s at, and can kick things off again at the right place sills anything go wrong.

TIL what bulk actually does…

And I found this video by @evanlitttle that takes me through the process. Note to self, have special SFW data collection for videos. :grin: https://youtu.be/d8BucVYOI24

I think this should suffice as it’s a one-time action. @adamhholmes, I like your suggestion and we’ll need it for an even bigger upcoming change.

Thank you all!

1 Like