{"id":14972185,"url":"https://github.com/ganeshkandu/kdbv","last_synced_at":"2025-10-12T03:16:15.515Z","repository":{"id":62508929,"uuid":"112827659","full_name":"GaneshKandu/kdbv","owner":"GaneshKandu","description":"mysql database auto schema migration library","archived":false,"fork":false,"pushed_at":"2018-07-31T03:49:46.000Z","size":111,"stargazers_count":9,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-31T22:22:26.638Z","etag":null,"topics":["autodeploy","automation","composer","data","database","database-migrations","latest-version","mariadb","migrations-generator","mysql","mysql-database","php","schema","seed","update","upgrade","upgrade-tool","version-changer","version-control","versioning"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GaneshKandu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-02T08:56:12.000Z","updated_at":"2022-01-24T10:42:16.000Z","dependencies_parsed_at":"2022-11-02T13:01:02.341Z","dependency_job_id":null,"html_url":"https://github.com/GaneshKandu/kdbv","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GaneshKandu%2Fkdbv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GaneshKandu%2Fkdbv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GaneshKandu%2Fkdbv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GaneshKandu%2Fkdbv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GaneshKandu","download_url":"https://codeload.github.com/GaneshKandu/kdbv/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238386093,"owners_count":19463295,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["autodeploy","automation","composer","data","database","database-migrations","latest-version","mariadb","migrations-generator","mysql","mysql-database","php","schema","seed","update","upgrade","upgrade-tool","version-changer","version-control","versioning"],"created_at":"2024-09-24T13:46:30.777Z","updated_at":"2025-10-12T03:16:10.487Z","avatar_url":"https://github.com/GaneshKandu.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# mysql database auto schema migration tool \n![](https://github.com/GaneshKandu/kdbv/blob/master/.github/kdbv_image.png)\n## how it works\n\u003e ```kdbv``` is Compare the structure of old database and latest database structure and make required queries to migrate old database\n\n- Create ```kdbv``` database\n  - dbv database is a single file witch contains database structure\n  - its created using ```make``` function\n- ```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\n- using ```query``` function you can get all sql queries. that need to migrate database\n  - its return array of queries\n\n#### Give star to library if you like **[STAR++](https://github.com/GaneshKandu/kdbv/stargazers)**\n\n## Features\n* **Upgrade** - Database Upgrade\n* **Easy** - Extremely easy to learn and use\n\n## Requirement\n\nPHP 5.3+ and PDO extension installed\n\n## Get Started\n\n### Installation\n\nThis library is designed to be installed via [Composer](https://getcomposer.org/doc/).\n\nAdd the dependency into your projects composer.json.\n```\n{\n  \"require\": {\n    \"ganeshkandu/kdbv\": \"*\"\n  }\n}\n```\n\nDownload the composer.phar\n``` bash\ncurl -sS https://getcomposer.org/installer | php\n```\n\nInstall the library.\n``` bash\nphp composer.phar install\n```\n\n#### or\n\n\u003e To add in in your dependencies\n\n``` bash\nphp composer.phar require ganeshkandu/kdbv\n```\n\n## Auto loading\n\nThis 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).\n\n``` php\nrequire('vendor/autoload.php');\n```\n\n## Usage\n\n### steps to perform\n* Create ```kdbv database``` using ```make``` function of your ```latest database```\n* deploy ```kdbv database``` with your application\n* 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``` ) \n* now you have your latest changed files with your old database which need to be update to new changes database structure\n* now ```upgrade``` your database using ```upgrade``` function\n* **ALL DONE ENJOY**\n* if you getting any issue [create an issue](https://github.com/GaneshKandu/kdbv/issues)\n\n### step 1\n\n#### Instantiate \u0026 load()\n\n```php\n// Using kdbv namespace\nnamespace kanduganesh;\n// just use this code to require auto loader on the top of your projects.\nrequire 'vendor/autoload.php';\n// Initialize\n$obj = new kdbv(array(\n\t'HOST' =\u003e '\u003cmysql_host\u003e',\n\t'DATABASE' =\u003e '\u003cmysql_database\u003e',\n\t'USER' =\u003e '\u003cdatabase_user\u003e',\n\t'PASS' =\u003e '\u003cdatabase_password\u003e',\n\t'PORT' =\u003e '\u003cmysql_port\u003e',\n\t'KDBV' =\u003e '\u003ckdbv_database_name\u003e', //name of kdbv database\n\t'PREFIX' =\u003e '\u003ctable prefix\u003e', //table prefix\n));\n```\n\u003e ```\u003ckdbv_database_name\u003e``` is a name of ```kdbv database``` which to be deploy with your application\n( _kdbv database contain database structure of your latest application_ )\n\n### step 2\n\u003e use ```$obj``` of step 1\n#### create ```kdbv database```\n\n```\n/*\nCreate kdbv database\nnotes :- during calling make function your mysql database should contain latest version database so it can store latest structure of database \n*/\n$obj-\u003emake(); \n```\n### step 3\n\u003e use ```$obj``` of step 1\n#### Get Mysql Upgrade Queries\n```php\n$sqls_queries = $obj-\u003equery();\nforeach($sqls_queries as $query){\n    echo $query.\"\\n\";\n}\n```\n## or\n### Upgrade mysql database\n```php\n/*\nupgrade mysql database\nnotes :- during calling upgrade function your kdbv database should be deployed with your application\nUpgrade your old mysql database to your latest mysql database structure\n*/\n$obj-\u003eupgrade();\n```\n\n## Best practices\n* run ```$obj-\u003emake();``` all time you when you release new application version with change database structure\n\n\n#### Maintainers\n\n- [Ganesh Kandu](https://github.com/GaneshKandu)\n\t- [Google+](https://plus.google.com/u/0/+ganeshkandu)\n\t- [Linkedin](https://www.linkedin.com/in/ganesh-kandu-42b14373/)\n\t- [EMail](mailto:kanduganesh@gmail.com)\n\t- [Follow](https://github.com/GaneshKandu)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fganeshkandu%2Fkdbv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fganeshkandu%2Fkdbv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fganeshkandu%2Fkdbv/lists"}