2017 © Pedro Peláez
 

library kdbv

mysql database auto schema migration tool

image

ganeshkandu/kdbv

mysql database auto schema migration tool

  • Friday, July 27, 2018
  • by GaneshKandu
  • Repository
  • 1 Watchers
  • 5 Stars
  • 27 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 8 Versions
  • 4 % Grown

The README.md

mysql database auto schema migration tool

, (*1)

how it works

kdbv is Compare the structure of old database and latest database structure and make required queries to migrate old database, (*2)

  • Create kdbv database
    • dbv database is a single file witch contains database structure
    • its created using make function
  • upgrade function is Compare the contents of your old databases with kdbv file ( witch contains latest database structure ) and Automate your data migrations from old to latest
  • using query function you can get all sql queries. that need to migrate database
    • its return array of queries

Give star to library if you like STAR++

Features

  • Upgrade - Database Upgrade
  • Easy - Extremely easy to learn and use

Requirement

PHP 5.3+ and PDO extension installed, (*3)

Get Started

Installation

This library is designed to be installed via Composer., (*4)

Add the dependency into your projects composer.json., (*5)

{
  "require": {
    "ganeshkandu/kdbv": "*"
  }
}

Download the composer.phar ``` bash curl -sS https://getcomposer.org/installer | php, (*6)


Install the library. ``` bash php composer.phar install

or

To add in in your dependencies, (*7)

``` bash php composer.phar require ganeshkandu/kdbv, (*8)


## Auto loading This library requires an autoloader, if you aren't already using one you can include [Composers autoloader](https://getcomposer.org/doc/01-basic-usage.md#autoloading). ``` php require('vendor/autoload.php');

Usage

steps to perform

  • Create kdbv database using make function of your latest database
  • deploy kdbv database with your application
  • You can simply overwrite latest version of your application on your old version of application ( NOTES latest version is deployed with kdbv database and kdbv library )
  • now you have your latest changed files with your old database which need to be update to new changes database structure
  • now upgrade your database using upgrade function
  • ALL DONE ENJOY
  • if you getting any issue create an issue

step 1

Instantiate & load()

// Using kdbv namespace
namespace kanduganesh;
// just use this code to require auto loader on the top of your projects.
require 'vendor/autoload.php';
// Initialize
$obj = new kdbv(array(
    'HOST' => '<mysql_host>',
    'DATABASE' => '<mysql_database>',
    'USER' => '<database_user>',
    'PASS' => '<database_password>',
    'PORT' => '<mysql_port>',
    'KDBV' => '<kdbv_database_name>', //name of kdbv database
    'PREFIX' => '<table prefix>', //table prefix
));

<kdbv_database_name> is a name of kdbv database which to be deploy with your application ( kdbv database contain database structure of your latest application ), (*9)

step 2

use $obj of step 1, (*10)

create kdbv database

/*
Create kdbv database
notes :- during calling make function your mysql database should contain latest version database so it can store latest structure of database 
*/
$obj->make(); 

step 3

use $obj of step 1, (*11)

Get Mysql Upgrade Queries

$sqls_queries = $obj->query();
foreach($sqls_queries as $query){
    echo $query."\n";
}

or

Upgrade mysql database

/*
upgrade mysql database
notes :- during calling upgrade function your kdbv database should be deployed with your application
Upgrade your old mysql database to your latest mysql database structure
*/
$obj->upgrade();

Best practices

  • run $obj->make(); all time you when you release new application version with change database structure

Maintainers

The Versions

27/07 2018

dev-master

9999999-dev

mysql database auto schema migration tool

  Sources   Download

GPL-3.0

The Requires

  • php >=5.3.0
  • ext-pdo *
  • ext-json *

 

by Ganesh Kandu

database schema php composer update packagist mysql data mariadb automation upgrade versioning version-control mysql-database upgrade-tool database-migrations version-changer latest-version autodeploy

30/12 2017

1.0.6

1.0.6.0

database auto upgrade tool

  Sources   Download

GPL-3.0

The Requires

  • php >=5.3.0
  • ext-pdo *

 

by Ganesh Kandu

database schema php composer update packagist mysql data mariadb automation upgrade versioning version-control mysql-database upgrade-tool database-migrations version-changer latest-version autodeploy

13/12 2017

1.0.5

1.0.5.0

database auto upgrade tool

  Sources   Download

GPL-3.0

The Requires

  • php >=5.3.0
  • ext-pdo *

 

by Ganesh Kandu

database schema php composer update packagist mysql data mariadb automation upgrade versioning version-control mysql-database upgrade-tool database-migrations version-changer latest-version autodeploy

12/12 2017

1.0.4

1.0.4.0

database versioning tool

  Sources   Download

GPL-3.0

The Requires

  • php >=5.3.0
  • ext-pdo *

 

by Ganesh Kandu

php composer update mysql upgrade versioning maria

08/12 2017

1.0.3

1.0.3.0

database versioning tool

  Sources   Download

GPL-3.0

The Requires

  • php >=5.3.0
  • ext-pdo *

 

by Ganesh Kandu

php composer update mysql upgrade versioning maria

07/12 2017

1.0.2

1.0.2.0

database versioning tool

  Sources   Download

GPL-3.0

The Requires

  • php >=5.3.0
  • ext-pdo *

 

by Ganesh Kandu

php composer update mysql upgrade versioning maria

05/12 2017

1.0.1

1.0.1.0

database versioning tool

  Sources   Download

GPL-3.0

The Requires

  • php >=5.3.0
  • ext-pdo *

 

by Ganesh Kandu

php composer update mysql upgrade versioning maria

02/12 2017

1.0.0

1.0.0.0

database versioning tool

  Sources   Download

GPL-3.0

The Requires

  • php >=5.3.0
  • ext-pdo *

 

by Ganesh Kandu

php composer update mysql upgrade versioning maria