Zeta Components Manual :: Docs For Class ezcDbSchemaDiff
DatabaseSchema::ezcDbSchemaDiff
Class ezcDbSchemaDiff
ezcDbSchemaDiff is the main class for schema differences operations.
Source for this file: /DatabaseSchema/src/schema_diff.php
Version: | //autogentag// |
Member Variables
public array(string=>ezcDbSchemaTableDiff) |
$changedTables
All changed tables |
public array(string=>ezcDbSchemaTable) |
$newTables
All added tables |
public array(string=>bool) |
$removedTables
All removed tables |
Method Summary
public static ezcDbSchemaDiff |
createFromFile(
$format
, $file
)
Factory method to create a ezcDbSchemaDiff object from the file $file with the format $format. |
public static void |
__set_state(
$array
)
|
public ezcDbSchemaDiff |
__construct(
[ $newTables
= array()] , [ $changedTables
= array()] , [ $removedTables
= array()] )
Constructs an ezcDbSchemaDiff object. |
public void |
applyToDb(
$db
)
Upgrades the database $db with the differences. |
public array(string) |
convertToDDL(
$db
)
Returns the $db specific SQL queries that would update the database $db |
public void |
writeToFile(
$format
, $file
)
Writes the schema differences to the file $file in format $format. |
Methods
createFromFile
static ezcDbSchemaDiff
createFromFile(
string
$format
, string
$file
)
Factory method to create a ezcDbSchemaDiff object from the file $file with the format $format.
Parameters:
Name | Type | Description |
---|---|---|
$format |
string | |
$file |
string |
Exceptions:
Type | Description |
---|---|
ezcDbSchemaInvalidReaderClassException |
if the handler associated with the $format is not a file schema reader. |
__set_state
static void
__set_state(
$array
)
Parameters:
Name | Type | Description |
---|---|---|
$array |
array |
__construct
ezcDbSchemaDiff
__construct(
[array(string=>ezcDbSchemaTable)
$newTables
= array()] , [array(string=>ezcDbSchemaTableDiff)
$changedTables
= array()] , [array(string=>bool)
$removedTables
= array()] )
Constructs an ezcDbSchemaDiff object.
Parameters:
Name | Type | Description |
---|---|---|
$newTables |
array(string=>ezcDbSchemaTable) | |
$changedTables |
array(string=>ezcDbSchemaTableDiff) | |
$removedTables |
array(string=>bool) |
applyToDb
void
applyToDb(
$db
)
Upgrades the database $db with the differences.
Parameters:
Name | Type | Description |
---|---|---|
$db |
ezcDbHandler |
Exceptions:
Type | Description |
---|---|
ezcDbSchemaInvalidWriterClassException |
if the handler associated with the $format is not a database schema writer. |
convertToDDL
array(string)
convertToDDL(
string|ezcDbHandler
$db
)
Returns the $db specific SQL queries that would update the database $db
The database type can be given as both a database handler (instanceof ezcDbHandler) or the name of the database as string as retrieved through calling getName() on the database handler object.
Parameters:
Name | Type | Description |
---|---|---|
$db |
string|ezcDbHandler |
Exceptions:
Type | Description |
---|---|
ezcDbSchemaInvalidWriterClassException |
if the handler associated with the $format is not a database schema writer. |
writeToFile
void
writeToFile(
string
$format
, string
$file
)
Writes the schema differences to the file $file in format $format.
Parameters:
Name | Type | Description |
---|---|---|
$format |
string | |
$file |
string |
Exceptions:
Type | Description |
---|---|
ezcDbSchemaInvalidWriterClassException |
if the handler associated with the $format is not a file schema writer. |
Documentation generated by phpDocumentor 1.4.3