portal.mkgtu.ru/common/db/views/createTableMigration.php

60 lines
878 B
PHP
Raw Normal View History

2024-03-28 09:51:45 +03:00
<?php
echo "<?php\n";
if (!empty($namespace)) {
echo "\nnamespace {$namespace};\n";
}
?>
use common\components\Migration\SafeMigration;
/**
* Handles the creation of table `<?= $table ?>`.
<?= $this->render('_foreignTables', [
'foreignKeys' => $foreignKeys,
]) ?>
*/
class <?= $className ?> extends SafeMigration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
<?= $this->render('_createTable', [
'table' => $table,
'fields' => $fields,
'foreignKeys' => $foreignKeys,
])
?>
<?php if (!empty($tableComment)) {
echo $this->render('_addComments', [
'table' => $table,
'tableComment' => $tableComment,
]);
}
?>
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
<?= $this->render('_dropTable', [
'table' => $table,
'foreignKeys' => $foreignKeys,
])
?>
}
}