|All requests||>||Recommendation for a PHP class to syn...||>||Request new recommendation||>||Featured requests||>||No recommendations|
by serio - 6 years ago (2014-11-04)
I want to synchronize a database between my nightrain PHP application running SQLite and the same application on the server running MySQL.
2. by Jacob Fogg - 6 years ago (2014-11-17) Reply
Just finished writing a class to do just this. Once it's approved, I'll recommend it here. You simply instantiate two PDO connections to your databases then call a method to sync each table, along with options about how you want to sync them. Including the use of a where clause which will allow you, for instance if you had a timestamp, to sync records after the time of your last sync operation. Again, as soon as my class is approved, I'll add it here.
1. by Manuel Lemos - 6 years ago (2014-11-04) Reply
I only find packages for synchronizing MySQL databases.
But you said you run the same application on development with SQLite and in production with MySQL.
Are you using an abstraction layer to make the application run equally with SQLite and MySQL?
This class should work well for you. It would be very easy to write a script that iterated over all of your tables to copy the entire database.
1. by Manuel Lemos - 6 years ago (2014-11-18) Reply
It seems to synchronize one table at a time. I wonder if it would be possible to somehow synchronize all tables at once.
2. by Jacob Fogg Reply- 6 years ago (2014-12-01) in reply to comment 1 by Manuel Lemos
Sure, that would just require one additional small script. Perhaps I could create an Ajax script that will iterate through the tables to prevent long running script errors.