Skip to content

Commit

Permalink
Document how a drive can be deleted manually
Browse files Browse the repository at this point in the history
Closes #360
  • Loading branch information
adriankumpf committed Jan 21, 2020
1 parent 0fdd0ad commit a2c5a79
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 28 additions & 0 deletions docs/maintenance/manually_fixing_data.md
Original file line number Diff line number Diff line change
@@ -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

This comment has been minimized.

Copy link
@cwanja

cwanja Jan 22, 2020

Collaborator

Per my comment in #360, this should be db. Again, per my install. I see that the YML files were updated. If I were to update, would my install bork?

```

## 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.

This comment has been minimized.

Copy link
@cwanja

cwanja Jan 22, 2020

Collaborator

At least in my install, the ID is not exposed in the drives URL.

- 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;
```

0 comments on commit a2c5a79

Please sign in to comment.