PHP Classes

mSync PHP Sync MySQL Databases: Update the MySQL database schema between servers

Recommend this page to a friend!
  Info   View files Documentation   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog (1)    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 169 This week: 1All time: 8,845 This week: 560Up
Version License PHP version Categories
msync 1.0.0Custom (specified...5PHP 5, Databases, Systems administration
Description 

Author

This class can update the MySQL database schema between servers.

It can connect to a given MySQL database server to retrieve the schema of the tables of a given database to create a schema definition in JSON format.

The class can also update the schema of the same database in different MySQL servers without losing the data already in the tables, so the database schemata are the same in the end.

Innovation Award
PHP Programming Innovation award nominee
July 2021
Number 5
Sometimes applications that use a database to store their data need to update the schema of the database tables to be able to implement new features.

Usually, developers start making changes to the database schema in the development environment. When the changes are well tested, they need to implement the same schema changes on the server-side.

This package provides a solution that uses schema definition files in JSON format to update the database schema either in the development environment or the production environment.

Manuel Lemos
Picture of Shabeer ALi M
  Performance   Level  
Name: Shabeer ALi M <contact>
Classes: 4 packages by
Country: India India
Age: ???
All time rank: 3645247 in India India
Week rank: 106 Up8 in India India Up
Innovation award
Innovation award
Nominee: 2x

Documentation

mSync

mSync - a MySQL schema synchronization utility

Description

mSync will create a schema file as JSON so that you can easily migrate schema to your production or any other work envirment easily. Currently mSync will support only table & views.

Why we use mSync

Developers find very hard to synchronize mysql schema. The current conventional method is to export to sql & update it in production. The main demerit of this method is all the old values of the production will be loose & the process is bit hectic. In Order to solve this we developed a platform where you can update the schema in a file and by running msync it will update only those changes without losing any old structure or data.

Prerequisites

To run mSync you need PHP.

Configuration

First you need to update the database configuration in mSync config file (config.php). In confi.php you can add multiple hosts with a host name.

Usage (CLI)

Create: Creating schema (schema.json) file from localhost. Make sure that localhost configuration is updated in config.php

php msyc.php create

Creating schema (schema.json) file from some other host (Ex: yourdomain.com).

php msyc.php create yourdomain.com

Update : Once the schema is created you can update/sync with other host or database by using update command.

//by the following query the schema.json will be update with your localhost
php msyc.php update

Updating remote mysql

php msyc.php update yourdomain.com

Note : If you are executing this query from localhost please make sure that your IP is accessible to update your production host.


  Files folder image Files  
File Role Description
Accessible without login Plain text file config.php Conf. Configuration script
Accessible without login Plain text file LICENSE Lic. License text
Plain text file msync.php Class Class source
Accessible without login Plain text file README.md Doc. Documentation

 Version Control Unique User Downloads Download Rankings  
 100%
Total:169
This week:1
All time:8,845
This week:560Up