tasks/ext/dbdeploy/DbDeployTask.php
\DbDeployTask
Generate SQL script for db using dbdeploy schema version table and delta scripts
- Parent(s)
- \Task < \ProjectComponent
- Author
- Luke Crouch at SourceForge (http://sourceforge.net)
- Version
- $Revision: 1395 $
Properties

string
$TABLE_NAME= ''changelog''
The tablename to use from the database for storing all changes This cannot be changed
'changelog'Details- Type
- string

array
$appliedChangeNumbers= 'array()'
Array with all change numbers that are applied already
array()Details- Type
- array

int
$checkall= 'false'
Checkall attribute False means dbdeploy will only apply patches that have a higher number than the last patchnumber that was applied True means dbdeploy will apply all changes that aren't applied already (in ascending order)
falseDetails- Type
- int

object
$dbmsSyntax= 'null'
Contains the object for the DBMS that is used
nullDetails- Type
- object

int
$lastChangeToApply= '999'
The number of the last change to apply
999Details- Type
- int

string
$outputFile= ''dbdeploy_deploy.sql''
Output file for performing all database patches of this deployment Contains all the SQL statements that need to be executed
'dbdeploy_deploy.sql'Details- Type
- string

string
$undoOutputFile= ''dbdeploy_undo.sql''
Outputfile for undoing the database patches of this deployment Contains all the SQL statements that need to be executed
'dbdeploy_undo.sql'Details- Type
- string
Methods

createOutputFile(
string $file, bool $undo
=
false
)
:
voidGenerate the sql for doing/undoing the deployment and write it to a file
| Name | Type | Description |
|---|---|---|
| $file | string | |
| $undo | bool |

fileNeedsToBeRead(
int $fileChangeNumber, string $lastChangeAppliedInDb
)
:
boolDetermine if this patch file need to be deployed (using fileChangeNumber, lastChangeAppliedInDb and $this->checkall)
| Name | Type | Description |
|---|---|---|
| $fileChangeNumber | int | |
| $lastChangeAppliedInDb | string |
| Type | Description |
|---|---|
| bool | True or false if patch file needs to be deployed |

generateSql(
bool $undo
=
false
)
:
stringGenerate the sql for doing/undoing this deployment
| Name | Type | Description |
|---|---|---|
| $undo | bool |
| Type | Description |
|---|---|
| string | The sql |

getAppliedChangeNumbers(
)
:
arrayGet the numbers of all the patches that are already applied according to the changelog table in the database
| Type | Description |
|---|---|
| array |

getDeltasFilesArray(
)
:
arrayGet a list of all the patch files in the patch file directory
| Type | Description |
|---|---|
| array |

getLastChangeAppliedInDb(
)
:
int | mixedGet the number of the last patch applied to the database
| Type | Description |
|---|---|
| int | mixed | The highest patch number that is applied in the db |

setCheckAll(
bool $checkall
)
:
voidSet the checkall property
| Name | Type | Description |
|---|---|---|
| $checkall | bool |

setDeltaSet(
string $deltaSet
)
:
voidSet the deltaset property
| Name | Type | Description |
|---|---|---|
| $deltaSet | string |

setDir(
string $dir
)
:
voidSet the directory where to find the patchfiles
| Name | Type | Description |
|---|---|---|
| $dir | string |

setLastChangeToApply(
int $lastChangeToApply
)
:
voidSet the lastchangetoapply property
| Name | Type | Description |
|---|---|---|
| $lastChangeToApply | int |

setOutputFile(
string $outputFile
)
:
voidSet the outputfile which contains all patch sql statements for this deployment
| Name | Type | Description |
|---|---|---|
| $outputFile | string |

setPassword(
string $password
)
:
voidSet the password for the database connection
| Name | Type | Description |
|---|---|---|
| $password | string |

setUndoOutputFile(
string $undoOutputFile
)
:
voidSet the undo outputfile which contains all undo statements for this deployment
| Name | Type | Description |
|---|---|---|
| $undoOutputFile | string |

setUrl(
string $url
)
:
voidSet the url for the database connection
| Name | Type | Description |
|---|---|---|
| $url | string |

setUserId(
string $userid
)
:
voidSet the userid for the database connection
| Name | Type | Description |
|---|---|---|
| $userid | string |