forked from propelorm/Propel2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
208 additions
and
61 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
src/Propel/Generator/Manager/templates/migration_template.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<?= '<?php' ?> | ||
|
||
use Propel\Generator\Manager\MigrationManager; | ||
|
||
/** | ||
* Data object containing the SQL and PHP code to migrate the database | ||
* up to version <?= $timestamp ?>. | ||
* Generated on <?= $timeInWords ?> <?= $migrationAuthor ?> | ||
*/ | ||
class <?= $migrationClassName ?> | ||
{ | ||
public $comment = '<?= $commentString ?>'; | ||
|
||
public function preUp(MigrationManager $manager) | ||
{ | ||
// add the pre-migration code here | ||
} | ||
|
||
public function postUp(MigrationManager $manager) | ||
{ | ||
// add the post-migration code here | ||
} | ||
|
||
public function preDown(MigrationManager $manager) | ||
{ | ||
// add the pre-migration code here | ||
} | ||
|
||
public function postDown(MigrationManager $manager) | ||
{ | ||
// add the post-migration code here | ||
} | ||
|
||
/** | ||
* Get the SQL statements for the Up migration | ||
* | ||
* @return array list of the SQL strings to execute for the Up migration | ||
* the keys being the datasources | ||
*/ | ||
public function getUpSQL() | ||
{ | ||
<?php foreach($migrationsUp as $connectionName => $sql): ?> | ||
<?= $connectionToVariableName[$connectionName] ?> = <<< 'EOT' | ||
<?= $sql ?> | ||
EOT; | ||
|
||
<?php endforeach;?> | ||
return array( | ||
<?php foreach($connectionToVariableName as $connectionName => $variableName): ?> | ||
'<?= $connectionName ?>' => <?= $variableName ?>, | ||
<?php endforeach;?> | ||
); | ||
} | ||
|
||
/** | ||
* Get the SQL statements for the Down migration | ||
* | ||
* @return array list of the SQL strings to execute for the Down migration | ||
* the keys being the datasources | ||
*/ | ||
public function getDownSQL() | ||
{ | ||
<?php foreach($migrationsDown as $connectionName => $sql): ?> | ||
<?= $connectionToVariableName[$connectionName] ?> = <<< 'EOT' | ||
<?= $sql ?> | ||
EOT; | ||
|
||
<?php endforeach;?> | ||
return array( | ||
<?php foreach($connectionToVariableName as $connectionName => $variableName): ?> | ||
'<?= $connectionName ?>' => <?= $variableName ?>, | ||
<?php endforeach;?> | ||
); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters