Download the PHP package scriptburn/db-version-update without Composer
On this page you can find all versions of the php package scriptburn/db-version-update. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download scriptburn/db-version-update
More information about scriptburn/db-version-update
Files in scriptburn/db-version-update
Package db-version-update
Short Description Package to update db structure acording to a target package version
License BSD-3-Clause
Informations about the package db-version-update
Package to update db structure acording to a target package version
Usage:
Create a child class like this (A sample child class has been provided as sampleDbUpdateService.php):
class DbUpdateService extends \Scriptburn\UpdateDb
{
// will be called for target db version 1
public function update_routine_1()
{
/* make sure to return true
other wise db update will stop propogating
and update process will run again
*/
return true;
}
// will be called for target db version 2
public function update_routine_2()
{
/* make sure to return true
other wise db update will stop propogating
and update process will run again
*/
return true;
}
}
Next we will Call the actual function that checks if db update is needed. Best place for this code will be in a middleware
// make sure composer.json has a key named dbversion in it
$optionalVersionData=['type' => 'composer', 'path' => "/path/to/composer.json"];
$dbUpdateCheck = new App\Services\DbUpdateService(< instance of \ScriptBurn\Settings >, < instance of pdo connection >, $optionalVersionData);
//If you passed $optionalVersionData as 3rd parameter to
App\Services\DbUpdateService
constructor you do not need to pass current db version to method maybeUpdate as second parameter $dbUpdateCheck->maybeUpdate('scriptburn/git-auto-deploy',< optional current db version no >');
All versions of db-version-update with dependencies
scriptburn/db-settings Version >=1.0
scriptburn/simple-debug Version >=1.0