Snapshot
Snapshot
Properties
version
public Version $version
comment
public string $comment
migration
public Migration $migration
Methods
create
public create(string $comment): self
Parameters
Parameter | Type | Description |
---|---|---|
$comment | string |
compare
Compare a master schema to a compare schema and generate a migration.
public compare(Schema $masterSchama, Schema $compareSchema): ?Migration
This method will compare the master schema to the compare schema and generate a migration that can be used to update the master schema to match the compare schema.
Parameters
Parameter | Type | Description |
---|---|---|
$masterSchama | Schema | |
$compareSchema | Schema |
setSchema
Sets the schema for the snapshot.
public setSchema(Schema $schema): void
This method takes a Schema object and converts it to a migration, which is then stored in the $migration property.
Parameters
Parameter | Type | Description |
---|---|---|
$schema | Schema | the schema to be set |
count
Counts the number of actions in the migration's "up" phase.
public count(): int
save
Saves the current migration snapshot to a JSON file in the specified target directory.
public save(Adapter $dbi, string $schemaInfoTable, string $targetDir): bool
Parameters
Parameter | Type | Description |
---|---|---|
$dbi | Adapter | |
$schemaInfoTable | string | |
$targetDir | string | the directory where the migration snapshot file will be saved |
getVersion
public getVersion(): Version
compareExtensions
private compareExtensions(Migration $migration, Schema $masterSchama, Schema $compareSchema): void
Parameters
Parameter | Type | Description |
---|---|---|
$migration | Migration | |
$masterSchama | Schema | |
$compareSchema | Schema |
compareTables
Compares the tables between the master schema and the compare schema, and generates the necessary migration actions.
private compareTables(Migration $migration, Schema $masterSchama, Schema $compareSchema): void
Parameters
Parameter | Type | Description |
---|---|---|
$migration | Migration | the migration object to which the actions will be added |
$masterSchama | Schema | the master schema to compare against |
$compareSchema | Schema | the schema to compare with the master schema |
compareConstraints
Compares the constraints between the master schema and the schema to be compared.
private compareConstraints(Migration $migration, Schema $masterSchama, Schema $compareSchema): void
If a constraint does not exist in the master schema, it adds a create action to the migration. If a constraint exists but is different, it adds an alter action to the migration.
Parameters
Parameter | Type | Description |
---|---|---|
$migration | Migration | the migration object to which actions will be added |
$masterSchama | Schema | the master schema to compare against |
$compareSchema | Schema | the schema to be compared |
compareIndexes
Compares the indexes between the master schema and the schema to be compared,
private compareIndexes(Migration $migration, Schema $masterSchama, Schema $compareSchema): void
and generates the appropriate migration actions.
Parameters
Parameter | Type | Description |
---|---|---|
$migration | Migration | the migration object to which actions will be added |
$masterSchama | Schema | the master schema containing the current state of the database |
$compareSchema | Schema | the schema to be compared against the master schema |
compareFunctions
private compareFunctions(Migration $migration, Schema $masterSchama, Schema $compareSchema): void
Parameters
Parameter | Type | Description |
---|---|---|
$migration | Migration | |
$masterSchama | Schema | |
$compareSchema | Schema |
compareTriggers
private compareTriggers(Migration $migration, Schema $masterSchama, Schema $compareSchema): void
Parameters
Parameter | Type | Description |
---|---|---|
$migration | Migration | |
$masterSchama | Schema | |
$compareSchema | Schema |
compareViews
private compareViews(Migration $migration, Schema $masterSchama, Schema $compareSchema): void
Parameters
Parameter | Type | Description |
---|---|---|
$migration | Migration | |
$masterSchama | Schema | |
$compareSchema | Schema |
Generated by Hazaar API Doc Generator