I have two backup files (bck) with different periods.
Can these two be restored to one teslamate?
The teslamate1.bck file that I backed up from January to April
There is a teslamate2.bck file that backed up data from May to June by installing teslamate again.
I installed a new teslamate and restored teslamate1.bck 1 bck as guided.
Restored normally.
After that, execute the following command for another period of bck file.
docker-compose exec -T database psql -U teslamate -d teslamate Then various errors appear as below. ERROR: type "length" already exists
...
ERROR: relation "addresses" already exists
...
ERROR: duplicate key value violates unique constraint "addresses_pkey"
...
ERROR: multiple primary keys for table "cars" are not allowed
....
....
I wish there was a way to combine bck files with different data.
What I recommend is manually editing the .bck file and combining them and making sure you dedup the data between the 2 files. The .bck file is just a SQL query.
It's a manual process, but it's doable. The issue you run into is if you dont drop the schema between data restores, it tries to create a ENUM that already exists... you could manually work around that by changing the .bck and wrapping in a IF statement like so:
DO $$
BEGIN
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'unit_of_length') THEN
CREATE TYPE public.unit_of_length AS ENUM (
'km',
'mi'
);
END IF;
END$$;
Thank you very much for the advice.
But... it's a very difficult task for me..
I should study more.
Ignore what I said above :) I am having to do the same thing now and yeah, it's not that simple. I'll let you know what I find out.
@Dulanic have you had any result? I must also combine two .bck files, so I am interested if there is a good way to do it :).
@Dulanic have you had any result? I must also combine two .bck files, so I am interested if there is a good way to do it :).
No,,,Not yet..
No there isn't a good way. I got it done but it was a lot of manual editing of the files. I had to edit drive id's, charging id's etc... since they were duplicated.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.