Improve document on clean database

This commit is contained in:
Daniel Pan 2024-11-21 13:54:10 +08:00
parent a8045331a4
commit 362d14735c

View File

@ -1,6 +1,6 @@
# Clean Database
### Session
## Session
Use the following command to clear expired session records in Seahub database:
@ -12,6 +12,15 @@ cd seafile-server-latest
!!! tip
Enter into the docker image, then go to `/opt/seafile/seafile-server-latest`
## Use clean_db_records command to clean seahub_db
Use the following command to simultaneously clean up table records of Activity, sysadmin_extra_userloginlog, FileAudit, FileUpdate, FileHistory, PermAudit, FileTrash 90 days ago:
```
./seahub.sh python-env python3 seahub/manage.py clean_db_records
```
You can also clean these tables manually if you like as following.
### Activity
@ -69,18 +78,11 @@ use seahub_db;
DELETE FROM FileHistory WHERE to_days(now()) - to_days(timestamp) > 90;
```
### Command clean_db_records
Use the following command to simultaneously clean up table records of Activity, sysadmin_extra_userloginlog, FileAudit, FileUpdate, FileHistory, PermAudit, FileTrash 90 days ago:
```
./seahub.sh python-env python3 seahub/manage.py clean_db_records
```
## Clean outdated library data
### Outdated Library Data
Since version 6.2, we offer command to clear outdated library records in Seahub database,
e.g. records that are not deleted after a library is deleted. This is because users can restore a deleted library, so we can't delete these records at library deleting time.
Since version 6.2, we offer command to clear outdated library records in Seafile database, e.g. records that are not deleted after a library is deleted. This is because users can restore a deleted library, so we can't delete these records at library deleting time.
```
./seahub.sh python-env python3 seahub/manage.py clear_invalid_repo_data
@ -97,8 +99,7 @@ This command has been improved in version 10.0, including:
```
### Library Sync Tokens
## Clean library sync tokens
There are two tables in Seafile db that are related to library sync tokens.