I had been using Teslamate with 2 cars in my account. Got rid of one of the cars. Is it possible / how do I remove that car from the database?
Easiest way is to run docker exec -it database psql -U teslamate -W teslamate
then just do a select * from cars; and find your old car... look at the id and then do a delete from cars where id = #replacing # /w the right car id.
Note that if you only delete the rows in the cars table, you'll run into internal errors when visiting TeslaMate's settings page. To fix this, run:
DELETE FROM car_settings WHERE id = 1234;
(where 1234 is the ID removed from the cars table).
docker exec -it my_database_container psql -U teslamate -W teslamate
SELECT id, vin FROM cars;
id | vin
----+-------------------
1 | 5YJ3E1EA2HF123456
2 | 5YJYGDEF7LF456789
(2 rows)
Assuming 5YJ3E1EA2HF123456 must be removed:
DELETE FROM cars WHERE id = 1;
DELETE FROM car_settings WHERE id = 1;
(Could we get a UI option? :))
Most helpful comment
Easiest way is to run
docker exec -it database psql -U teslamate -W teslamatethen just do a
select * from cars;and find your old car... look at the id and then do adelete from cars where id = #replacing # /w the right car id.