Add draft for Database page
parent
416dff4fa7
commit
de9b4ab4dc
|
@ -0,0 +1,16 @@
|
|||
**_This page is in an early state and not yet completed or reviewed!_**
|
||||
|
||||
This pages gives some information on the internal app database. In short, you learn about the [database structure](#database-structure) and [how to modify it](#modifying-the-database-structure) as well as how to [access the stored data](#access-data).
|
||||
|
||||
## Database structure
|
||||
NewPipe is a streaming frontend. For this reason, storing information on `streams` is the database's core functionality.
|
||||
Basically, stream information is used for feeds, playlists and watch history.
|
||||
|
||||
![NewPipe's database structure](https://user-images.githubusercontent.com/17365767/141841352-eefcd324-abfe-480b-9626-17db21f6c9de.png)
|
||||
|
||||
### Modifying the database structure
|
||||
When modifying the database structure, the [database version needs to be increased](https://github.com/TeamNewPipe/NewPipe/blob/dev/app/src/main/java/org/schabi/newpipe/database/AppDatabase.java#L41).
|
||||
You also need to create a migration to update the structure on installations which run an old database version. This is done in the [`Migrations`](https://github.com/TeamNewPipe/NewPipe/blob/dev/app/src/main/java/org/schabi/newpipe/database/Migrations.java) class. After creating the migration, it needs to be [registered with the database](https://github.com/TeamNewPipe/NewPipe/blob/dev/app/src/main/java/org/schabi/newpipe/NewPipeDatabase.java#L26) to be executed if necessary.
|
||||
|
||||
## Access data
|
||||
Add some info on the DAO pattern here; AppDatabase and NewPipeDatabase
|
Loading…
Reference in New Issue