How to Set Up Light Weight Data Type (Post-Launch)


I want to start using a lightweight user type mainly to perform searches and fetch simple content such as profile photo, handle, and name.

My current “user” datatype would be renamed as user-heavyweight, as this data type has all of the aforementioned data + tons of lists, options, and data that bubble ought not have to fetch each time I want to load in a new profile.

I want to create the “lightweight user” data type but I have no idea what operation to perform that will allow me to essentially link the two datatypes together.

Sure, I can add a data field within “lightweight user” that allows for a specific user to be tied to this data type, but how do I automate this process, as it’ll be too time lengthy to manually set this user by user

Once you’ve defined your new DB structure as you explained, you can automate the migration to the new structure.

First, go to the backend workflows section - you’ll see it on the pages dropdown on the top left (activate backend WFs from settings if you haven’t)

Then set up a backend API WF that accepts one User, creates a Lightweight User thing, and connects the two together. Make sure this is marked as not exposed as an API WF and you can let it override privacy rules since it’s a one-time migration.

Then head over to your App Data tab, open the Users table, pick one User and hit the ‘BULK’ button on the top right. This will give you a dropdown of API WFs that accept a User as input. Pick the one you created, make sure the List to Modify is just the one selected User, and then hit ‘Run Workflow’.

Bubble will run this API workflow on the selected User and you can take a look at the results on the DB as well as in your app to see if all is OK. You could modify the API WF as needed based on this.

Once you’re confident about this API WF, do the same process and instead of running it on just the one selected User, run it on all Users.

Keep in mind that this is a permanent change to your database, so be extra careful while running it. Maybe test it on version-test data before running it on Live.

All the best!

Wow! You’re a godsend bro. After 3 years of bubbling I’m still finding new features such as the bulk operation I just used.

Thank you so much. It took 2 minutes to implement your solution, and it worked perfectly :slight_smile:

it’s a pleasure :slight_smile:
All the best