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

Read changelog.sql directory and compare it with database. More...

Public Member Functions

 __construct ($pdo)
 Constructor. More...
 
 getDatabaseInfo ()
 Returns info about currently used database (it should be short string)
 
 loadChangelogDir ($dir, $use_git)
 Load SQL scripts from changelog directory. More...
 
 loadChangelogTable ($table)
 Load records from changelog table. More...
 
 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.
 

Protected Attributes

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

Detailed Description

Read changelog.sql directory and compare it with database.

Constructor & Destructor Documentation

__construct (   $pdo)

Constructor.

Parameters
$pdois PDO instance connected to database.

Member Function Documentation

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.