Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Default table rows/data

How do I have default values for a table? For example table Permissions with ID and Name column to have these rows when the app is installed:

ID Name
1 Edit Product
2 Add Product
3 Delete Product

etc.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

This is called Pre-Populate Room Database, you can achieve that by creating a new sql file having the same schema as your Room Database and containing the data that you want, and after that you need to add that .sql file to your project and add it to the Room Database:

Follow this tutorial to have a detailed explanation on how to achieve that: enter link description here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading