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.
CodePudding user response:
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