f819c230
Yarik
test
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
<?php
use yii\db\Migration;
class m160204_103008_add_payment_connections extends Migration
{
public function up ()
{
$this->createTable (
'{{%payment}}', [
'payment_id' => $this->primaryKey (), 'name' => $this->string (255)
->notNull (), 'status' => $this->integer ()
->defaultValue (1),
], null
);
$this->batchInsert ('{{%payment}}', ['name'], [['Наличный расчет'], ['Безналичный расчет'], ['Электронные деньги']]);
$this->createTable (
'{{%user_payment}}', [
'user_payment_id' => $this->primaryKey (), 'user_id' => $this->integer (), 'payment_id' => $this->integer (),
]
);
$this->createTable (
'{{%user_specialization}}', [
'user_specialization_id' => $this->primaryKey (), 'user_id' => $this->integer (), 'specialization_id' => $this->integer (),
]
);
$this->addForeignKey ('user_speialization_specialization', '{{%user_specialization}}', 'specialization_id', '{{%specialization}}', 'specialization_id', 'CASCADE', 'CASCADE');
$this->addForeignKey ('user_payment_payment', '{{%user_payment}}', 'payment_id', '{{%payment}}', 'payment_id', 'CASCADE', 'CASCADE');
}
public function down ()
{
|