portal.mkgtu.ru/common/migrations/db/m160525_134623_add_code_set...

65 lines
1.7 KiB
PHP
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
use common\components\Migration\MigrationWithDefaultOptions;
use common\models\settings\CodeSetting;
class m160525_134623_add_code_settings extends MigrationWithDefaultOptions
{
public function safeUp()
{
$code = CodeSetting::findOne([
'name' => 'category_olympiad'
]);
if (empty($code)) {
$this->insert(
'{{%code_settings}}',
[
'value' => '000000001',
'name' => 'category_olympiad',
'description' => 'Код категории приема без вступительных испытаний',
]
);
}
$code = CodeSetting::findOne([
'name' => 'category_specific_law'
]);
if (empty($code)) {
$this->insert(
'{{%code_settings}}',
[
'value' => '000000002',
'name' => 'category_specific_law',
'description' => 'Код категории приема абитуриентов имеющих особое право',
]
);
}
$code = CodeSetting::findOne([
'name' => 'category_all'
]);
if (empty($code)) {
$this->insert(
'{{%code_settings}}',
[
'value' => '000000003',
'name' => 'category_all',
'description' => 'Код категории приема на общих основаниях',
]
);
}
}
public function safeDown()
{
echo "m140501_075310_add_code_settings cannot be reverted.\n";
}
}