sqlite - How to handle multi-user data storage in Android?
大家讲道理2017-05-16 13:33:38
0
5
2645
The current implementation is that one User corresponds to one database. But I think it is also possible to add a User table and use foreign key association. Don't know which implementation is better? Are there any other ways to achieve this?
From the perspective of easy upgrade, it is better to use
一个数据库+外键关联
, especially when using a third-party ORM.Same as the website backend, use User+foreign keys, as mentioned above, if you upgrade the table structure one by one, you will be exhausted.
One User corresponds to one database, and data search is fast
What effect do you want to achieve?
Or what data is stored?
You can create tables by user (table name + user ID)