Document how a drive can be deleted manually

Closes #360
This commit is contained in:
Adrian Kumpf
2020-01-21 17:16:32 +01:00
parent 0fdd0ad8b1
commit a2c5a7991c
3 changed files with 30 additions and 0 deletions
+1
View File
@@ -71,6 +71,7 @@ The full TeslaMate documentation is available on [Read the Docs](https://teslama
- [Environment Variables](https://teslamate.readthedocs.io/en/latest/configuration/environment_variables.html)
- Maintenance
- [Backup and Restore](https://teslamate.readthedocs.io/en/latest/maintenance/backup_restore.html)
- [Manually fixing data](https://teslamate.readthedocs.io/en/latest/maintenance/manually_fixing_data.html)
- Development and Contributing
- [Development](https://teslamate.readthedocs.io/en/latest/development.html)
+1
View File
@@ -41,6 +41,7 @@ A powerful, self-hosted data logger for your Tesla.
:caption: Maintenance
maintenance/backup_restore.md
maintenance/manually_fixing_data.md
.. toctree::
:maxdepth: 1
+28
View File
@@ -0,0 +1,28 @@
# Manually fixing data
## Docker: Connect to the database container
When using TeslaMate with Docker, you must first connect to the **running** database container before queries can be executed.
```bash
docker-compose exec database psql teslamate teslamate
```
## Delete a specific drive
If for some reason a drive was recorded incorrectly, you can delete it manually.
First you need to find out the ID of the drive you want to delete:
- Open the `Drives` dashboard and click on the start date of the drive.
- The URL will contain the drive id, for example `&var-drive_id=9999`.
Afterwards run the following query:
```sql
BEGIN;
UPDATE drives SET start_position_id = NULL, end_position_id = NULL WHERE id = 9999;
DELETE FROM positions WHERE drive_id = 9999;
DELETE FROM drives WHERE id = 9999;
COMMIT;
```