Combining data from 2 databases

Jacoba year ago

Long story short, I have 2 traccar databases that both have data I need to keep. The first one contains data up until about 2 weeks ago. The second one contains the exact same data until mid January and data from the last 2 weeks, nothing in between. Same devices for both of them. I would like to export the location data from the last 2 weeks and import it into the first database (then fix my backup strategy so I don't have to do this again).

I'm seeing in the database that every data point has a sequential ID and an attributes field with the total distance. If I exported the recent data and imported it into the other database, how would those conflict? Specifically:

  • I'm assuming that if I need to retrieve, say, the route I took today, it would sort by devicetime and that ID is not used for sorting. If ID is used for sorting anywhere in the app that may cause issues with things being out of order
  • There will be differences in total distance, how badly will my reports be screwed up? Would it simply act as if I'd modified the total distance from the frontend or would it be worse than that?
  • Are rows in tc_statistics calculated automatically when a report is requested or would I have to copy those over too?

Thank you.

Anton Tananaeva year ago

Position id is references in a few places, like events, but it's not used for any ordering.

Total distance will be the same as if you reset it. Should cause big problems.

Statistics is generated daily. If you need it, you have to copy it over. Usually it's not really considered critical info.