I have a Django application which uses PostgreSQL as a database. The application stores hierarchical data. It is like a warehouse management system with multiple branches and hierarchy.
The current version is deployed on one main server and every other warehouse communicates directly with that server.
We want to add additional warehouses, but they are not well connected to internet (bad signal, bad channels, slow) so we are going to deploy application locally and synchronize the data with the main server in the background using database tools.
We don't want to rewrite the whole application and tables with additional "is_synchronized" columns.
Main - Branch A (connects to Main directly via Web UI) --- Branch A.1 (fine) --- Branch A.2 (fine) ... - Branch B (slow connection to Main) deploy locally --- Branch B.1 (slow -> B) deploy locally --- Branch B.2 (slow -> B) deploy locally
B.1 should synchronize the data to B's server and B should see all the data from their remote B.1, B.2 branches eventually. The same should happen with the Main server, it should see all the data from A and B branches eventually and same with their child branches.
In summary every parent should see every child's data (in case of a slow connection, eventually is fine)
How can we achieve this? What should we read? (we are total beginners in DB technologies, only web guys)
UPDATE: The child branches don't get data from parent. The child stores its own data and sends data to parent, parent stores all child data and its own. Main stores everything from everywhere