guild/console/migrations/m220111_084946_add_default_document_field.php
2022-01-11 12:06:01 +03:00

63 lines
1.5 KiB
PHP
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 yii\db\Migration;
/**
* Class m220111_084946_add_default_document_field
*/
class m220111_084946_add_default_document_field extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
Yii::$app->db->createCommand()->batchInsert('document_field', [ 'title', 'field_template'],
[
['№ документа', '№ dokumenta'],
['от', 'ot'],
['Сумма с НДС', 'Summa s NDS'],
['НДС', 'NDS'],
['Основание', 'Osnovaniye'],
['Цена', 'Tsena'],
['К договору', 'K dogovoru'],
['№', '№']
])->execute();
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
Yii::$app->db->createCommand()->delete('document_field',
[
'in', 'title', [
'№ документа',
'от',
'Сумма с НДС',
'НДС',
'Основание',
'Цена',
'К договору',
'№',
]
])->execute();
}
/*
// Use up()/down() to run migration code without a transaction.
public function up()
{
}
public function down()
{
echo "m220111_084946_add_default_document_field cannot be reverted.\n";
return false;
}
*/
}