Blame view

console/migrations/m160208_094102_add_project_specialization.php 2.15 KB
a82865e3   Administrator   add Vitaliy's wid...
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
  <?php
  
  use yii\db\Migration;
  
  class m160208_094102_add_project_specialization extends Migration
  {
      public function up ()
      {
          $this->createTable (
              '{{%project_specialization}}', [
                  'project_specialization_id' => $this->primaryKey (), 'project_id' => $this->integer (), 'specialization_id' => $this->integer (),
              ]
          );
          $this->addForeignKey ('project_specialization_index', '{{%project_specialization}}', 'specialization_id', '{{%specialization}}', 'specialization_id', 'CASCADE', 'CASCADE');
          $this->addForeignKey ('specialization_project_index', '{{%project_specialization}}', 'project_id', '{{%project}}', 'project_id', 'CASCADE', 'CASCADE');
  
          $this->createTable (
              '{{%project_payment}}', [
                  'project_payment_id' => $this->primaryKey (), 'project_id' => $this->integer (), 'payment_id' => $this->integer (),
              ]
          );
          $this->addForeignKey ('project_payment_index', '{{%project_payment}}', 'payment_id', '{{%payment}}', 'payment_id', 'CASCADE', 'CASCADE');
          $this->addForeignKey ('payment_project_index', '{{%project_payment}}', 'project_id', '{{%project}}', 'project_id', 'CASCADE', 'CASCADE');
  
          $this->createTable (
              '{{%employment}}', [
ea09d15d   Yarik   test
27
                  'employment_id' => $this->primaryKey (), 'name' => $this->string(),
a82865e3   Administrator   add Vitaliy's wid...
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
              ]
          );
          $this->createTable (
              '{{%vacancy_employment}}', [
                  'vacancy_employment' => $this->primaryKey (), 'vacancy_id' => $this->integer (), 'employment_id' => $this->integer (),
              ]
          );
          $this->addForeignKey ('vacancy_employment_index', '{{%vacancy_employment}}', 'employment_id', '{{%employment}}', 'employment_id', 'CASCADE', 'CASCADE');
          $this->addForeignKey ('employment_vacancy_index', '{{%vacancy_employment}}', 'vacancy_id', '{{%vacancy}}', 'vacancy_id', 'CASCADE', 'CASCADE');
  
      }
  
      public function down ()
      {
          $this->dropTable('{{%project_specialization}}');
          $this->dropTable('{{%project_payment}}');
          $this->dropTable('{{%vacancy_employment}}');
          $this->dropTable('{{%employment}}');
  
      }
  
  }