PHP Classes

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

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 173 All time: 8,802 This week: 37Up
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: 3531233 in India India
Week rank: 227 Up15 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 (4)  
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

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:173
This week:0
All time:8,802
This week:37Up