Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Room Generating Dynamic Tables

Tags:

android-room

I have a table for users. The user creates a category, and then assigns Youtube videos to the category. I currently have a user table, category table (user-id foreign key), and youtubevideo table (user-id foreign key, category foreign key).

I currently query the category and youtubevideo for the user's id, but I assume these queries could become burdensome as the database grows.

I would instead like to dynamically create a unique table for each user's category based off the user's id, e.g. User 52 has table - category-52, and youtubevideos-52. Is this possible or feasible with Room?

like image 789
jwagn90pl Avatar asked Mar 08 '23 06:03

jwagn90pl


1 Answers

It is not, Room generates schema using annotations. Annotations are processed before compilation using annotationProcessors. Because of this it is not possible to generate tables at runtime.

like image 53
Abhishek Bansal Avatar answered Mar 20 '23 22:03

Abhishek Bansal