Answer the question
In order to leave comments, you need to log in
How to program PHP / MYSQL so that later you can synchronize the database?
Suppose there is a simple DB
table sale: sale_id, nomenclature_id, count, price, sum...
table
nomenclature: nomenclature_id, name...
was to sync?
from a simple thing that comes to mind - these are the prefixes of branches in id (1000001, 1000002 - the id of all records in branch 1 and N000001, N000002, .... in branch N), but then during synchronization, items with the same name and different ID will pop up , if both branches, for example, buy a light bulb for the first time and capitalize it each by creating an item.
What is the principle of building such programs so as not to reinvent the wheel and write your own synchronization algorithms, but to use something standard / ready-made like rsync?
Answer the question
In order to leave comments, you need to log in
What and with what to synchronize?
To prevent id from overlapping on several nodes, you can use UUID.
Anything else like microtime + node ID is possible, but it is hardly necessary without some serious performance requirements
use natural keys rather than surrogate autoincremental ones
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question