PHP MySQL Scheman: Make MySQL database schema changes generating SQL

Recommend this page to a friend!
  Info   View files Example   View files View files (20)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog (1)    
Last Updated Ratings Unique User Downloads Download Rankings
2021-07-16 (1 month ago) RSS 2.0 feedNot yet rated by the usersTotal: 68 This week: 1All time: 9,874 This week: 174Up
Version License PHP version Categories
mysql-scheman 1.0.0The PHP License5PHP 5, Databases, Systems administration
Description Author

This package can make MySQL database schema changes generating SQL.

It can connect to a given MySQL database server using credentials read from an XML or JSON configuration files.

The package can extract the database table schema and generates a JSON file that describes the table structure.

It can also connect to another MySQL database server and generates the necessary SQL statements to perform the table schema changes to update it to be the same that is read from a JSON file previously generated from the schema of the database that is more up to date.

Innovation Award
PHP Programming Innovation award nominee
July 2021
Number 5
Database schema changes are necessary to perform when an application needs to evolve and store more information in its database tables.

Changing a database schema is a delicate operation. The changes to be done on the database schema need to be done in the right order and use the correct SQL statements so that multiple changes can be done successfully.

This package provides a safer solution by generating a JSON file with the current database table schema definition.

Then the developer can make the database schema changes he wants in the JSON file so that the package can perform the necessary changes executing the correct SQL statements in the correct order.

Manuel Lemos
Picture of Shabeer ALi M
  Performance   Level  
Name: Shabeer ALi M <contact>
Classes: 3 packages by
Country: India India
Innovation award
Innovation award
Nominee: 2x

Details

MySQL Scheman

MySQL schema, a simple MySQL schema synchronization utility. This will create an UPDATE/ADD query automatically based on the schema difference in the database and schema file.

Build

Why we use MySQL Scheman

Developers find it very hard to synchronize MySQL schema while developing any application. The current conventional method is to create an SQL file with all the changes & update it in the staging/production server. The main demerit of this method is if there are multiple people and multiple SQL changes on the same table the process is a bit hectic. In order to solve this, we developed a platform where you can update the schema in a file, and by running sync to database it will create the SQL Query for the changes and it will execute.

Installation

If you use Composer, you can install MySQL Scheman with the following command:


Or alternatively, include a dependency for MySQL Scheman in your composer.json file. For example

{

"require-dev": {
    "smart-php/mysql-scheman": "dev-master"
}

}


### Config

A database configuration file should be there to communicate with the database. Please see the sample files and create a copy in your working directory with your database credentials.

JSON: config.json
XML: config.xml

### Usage (CLI)

To CLI Help

./vendor/bin/scheman --help


Exporting Database to Schema File:

./vendor/bin/scheman --config config.json --export yourdatabase.json


Sync the file schema with your database

./vendor/bin/scheman --config config.json --sync yourdatabase.json


## License
See the `LICENSE` file.
  Files folder image Files  
File Role Description
Files folder image.github (1 directory)
Files folder imagebin (2 files)
Files folder imagesrc (7 files, 3 directories)
Files folder imagetests (1 file)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file config.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  .github  
File Role Description
Files folder imageworkflows (1 file)

  Files folder image Files  /  .github  /  workflows  
File Role Description
  Accessible without login Plain text file php.yml Data Auxiliary data

  Files folder image Files  /  bin  
File Role Description
  Accessible without login Plain text file scheman Appl. Application script to run from the shell
  Plain text file scheman.php Class Class source

  Files folder image Files  /  src  
File Role Description
Files folder imageDriver (2 directories)
Files folder imageReader (2 directories)
Files folder imageWriter (2 directories)
  Plain text file DriverInterface.php Class Class source
  Plain text file MysqlScheman.php Class Class source
  Plain text file MysqlSchemanCli.php Class Class source
  Plain text file QueryBuilder.php Class Class source
  Plain text file ReaderInterface.php Class Class source
  Plain text file SchemaDiffer.php Class Class source
  Plain text file WriterInterface.php Class Class source

  Files folder image Files  /  src  /  Driver  
File Role Description
Files folder imageMysqli (1 file)
Files folder imagePdo (1 file)

  Files folder image Files  /  src  /  Driver  /  Mysqli  
File Role Description
  Plain text file Driver.php Class Class source

  Files folder image Files  /  src  /  Driver  /  Pdo  
File Role Description
  Plain text file Driver.php Class Class source

  Files folder image Files  /  src  /  Reader  
File Role Description
Files folder imageJson (1 file)
Files folder imageXml (1 file)

  Files folder image Files  /  src  /  Reader  /  Json  
File Role Description
  Plain text file Reader.php Class Class source

  Files folder image Files  /  src  /  Reader  /  Xml  
File Role Description
  Plain text file Reader.php Class Class source

  Files folder image Files  /  src  /  Writer  
File Role Description
Files folder imageJson (1 file)
Files folder imageXml (1 file)

  Files folder image Files  /  src  /  Writer  /  Json  
File Role Description
  Plain text file Writer.php Class Class source

  Files folder image Files  /  src  /  Writer  /  Xml  
File Role Description
  Plain text file Writer.php Class Class source

  Files folder image Files  /  tests  
File Role Description
  Accessible without login Plain text file test.php Example Example script

 Version Control Unique User Downloads Download Rankings  
 100%
Total:68
This week:1
All time:9,874
This week:174Up
For more information send a message to info at phpclasses dot org.