Changelog.SQL  v1.2-1-g4629c08
Public Member Functions | Protected Attributes | List of all members
ChangelogSqlDiff Class Reference

Description

Read changelog.sql directory and compare it with database.

Public Member Functions

 __construct ($pdo)
 Constructor. More...
 
 getDatabaseInfo ()
 Returns info about currently used database (it should be short string) More...
 
 loadChangelogDir ($dir, $use_git)
 Load SQL scripts from changelog directory. More...
 
 loadChangelogTable ($table)
 Load records from changelog table. More...
 
 compare ()
 Compare loaded data. More...
 
 needsUpdate ()
 Get list of updates to perform. More...
 
 needsExec ()
 Get list of scripts to execute. More...
 
 getInsertQuery ($script)
 Generate SQL query suitable for inserting new record into changelog. More...
 
 getScriptSql ($script)
 Get content of the SQL script. More...
 
 loadInitScriptsDir ($dir)
 Load scripts with init files. More...
 
 initScripts ()
 Get list of init scripts to execute. More...
 
 getInitScriptSql ($script)
 Get content of the SQL init script. More...
 

Protected Attributes

 $pdo
 PDO database driver. More...
 
 $scripts = array()
 SQL scripts from changelog. More...
 
 $changelog = array()
 List of completed scripts (loaded from database). More...
 
 $init_scripts = array()
 SQL scripts from init directory. More...
 
 $needs_update = null
 List of scripts which needs to be manualy updated. More...
 
 $needs_exec = null
 List of scripts which needs to be executed. More...
 

Constructor & Destructor Documentation

__construct (   $pdo)

Constructor.

Parameters
$pdois PDO instance connected to database.

Member Function Documentation

getDatabaseInfo ( )

Returns info about currently used database (it should be short string)

loadChangelogDir (   $dir,
  $use_git 
)

Load SQL scripts from changelog directory.

Returns
Total count of loaded scripts.
loadChangelogTable (   $table)

Load records from changelog table.

Returns
Total count of loaded records.
compare ( )

Compare loaded data.

needsUpdate ( )

Get list of updates to perform.

needsExec ( )

Get list of scripts to execute.

getInsertQuery (   $script)

Generate SQL query suitable for inserting new record into changelog.

getScriptSql (   $script)

Get content of the SQL script.

loadInitScriptsDir (   $dir)

Load scripts with init files.

initScripts ( )

Get list of init scripts to execute.

getInitScriptSql (   $script)

Get content of the SQL init script.

Member Data Documentation

$pdo
protected

PDO database driver.

$scripts = array()
protected

SQL scripts from changelog.

$changelog = array()
protected

List of completed scripts (loaded from database).

$init_scripts = array()
protected

SQL scripts from init directory.

$needs_update = null
protected

List of scripts which needs to be manualy updated.

$needs_exec = null
protected

List of scripts which needs to be executed.