add accompanying document
This commit is contained in:
@ -14,7 +14,10 @@ class m220110_205045_create_accompanying_document_table extends Migration
|
||||
{
|
||||
$this->createTable('{{%accompanying_document}}', [
|
||||
'id' => $this->primaryKey(),
|
||||
'document_id' => $this->integer(11),
|
||||
'title' => $this->string()->notNull(),
|
||||
]);
|
||||
$this->addForeignKey('document_accompanying_document', 'accompanying_document', 'document_id', 'document', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -22,6 +25,7 @@ class m220110_205045_create_accompanying_document_table extends Migration
|
||||
*/
|
||||
public function safeDown()
|
||||
{
|
||||
$this->dropForeignKey('document_accompanying_document', 'accompanying_document');
|
||||
$this->dropTable('{{%accompanying_document}}');
|
||||
}
|
||||
}
|
||||
|
63
console/migrations/m220111_082339_add_default_templates.php
Normal file
63
console/migrations/m220111_082339_add_default_templates.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Migration;
|
||||
|
||||
/**
|
||||
* Class m220111_082339_add_default_templates
|
||||
*/
|
||||
class m220111_082339_add_default_templates extends Migration
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeUp()
|
||||
{
|
||||
$time = new \yii\db\Expression('NOW()');
|
||||
Yii::$app->db->createCommand()->batchInsert('template', [ 'title', 'created_at' ],
|
||||
[
|
||||
['Акт', $time],
|
||||
['Акт сверки', $time],
|
||||
['Детализация', $time],
|
||||
['Доверенность', $time],
|
||||
['Договор', $time],
|
||||
['Доп соглашение к договору', $time],
|
||||
['Транспортная накладная', $time],
|
||||
['Ценовой лист', $time],
|
||||
])->execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeDown()
|
||||
{
|
||||
Yii::$app->db->createCommand()->delete('template',
|
||||
[
|
||||
'in', 'title', [
|
||||
'Акт',
|
||||
'Акт сверки',
|
||||
'Детализация',
|
||||
'Доверенность',
|
||||
'Договор',
|
||||
'Доп соглашение к договору',
|
||||
'Транспортная накладная',
|
||||
'Ценовой лист',
|
||||
]
|
||||
])->execute();
|
||||
}
|
||||
|
||||
/*
|
||||
// Use up()/down() to run migration code without a transaction.
|
||||
public function up()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
echo "m220111_082339_add_default_templates cannot be reverted.\n";
|
||||
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
<?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;
|
||||
}
|
||||
*/
|
||||
}
|
Reference in New Issue
Block a user