Blame view

console/migrations/m160712_142430_create_road_width.php 1.94 KB
984ae8aa   Eugeny Galkovskiy   120716
1
2
3
4
5
6
7
8
9
  <?php
  
  use yii\db\Migration;
  
  /**
   * Handles the creation for table `road_width`.
   */
  class m160712_142430_create_road_width extends Migration
  {
2ebaccd7   Eugeny Galkovskiy   120716
10
  
984ae8aa   Eugeny Galkovskiy   120716
11
12
13
      /**
       * @inheritdoc
       */
a1e5908c   Yarik   Yarik
14
      public function safeUp()
984ae8aa   Eugeny Galkovskiy   120716
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
      {
          $this->createTable('road_width', [
              'road_width_id' => $this->primaryKey()->comment('Індекс'),
              'region_id' => $this->integer()->comment('Область'),
              'road_id' => $this->integer()->comment('Дорога'),
              'begin' => $this->float()->comment('Місцезнаходженя, км+ початок'),
              'end' => $this->float()->comment('Місцезнаходженя, км+ кінець'),
              'width_roadside_left' => $this->float()->comment('Ширина, узбіччя зліва'),
              'width_reverse_road' => $this->float()->comment('Ширина, проїзна зворотнього напрямку'),
              'width_strip' => $this->float()->comment('Ширина, розподільча смуга'),
              'width_roadway_forward' => $this->float()->comment('Ширина, проїзна прямого напрямку'),
              'width_roadside_right' => $this->float()->comment('Ширина, узбіччя справа'),
              'count_lane_left' => $this->float()->comment('Кількість смуг руху зліва'),
              'count_lane_right' => $this->float()->comment('Кількість смуг руху справа'),
  
          ]);
          $this->addForeignKey('road_width_region', 'road_width', 'region_id', 'region', 'region_id', 'CASCADE', 'CASCADE');
          $this->addForeignKey('road_width_road', 'road_width', 'road_id', 'road', 'road_id', 'CASCADE', 'CASCADE');
      }
  
      /**
       * @inheritdoc
       */
a1e5908c   Yarik   Yarik
38
      public function safeDown()
984ae8aa   Eugeny Galkovskiy   120716
39
40
41
42
43
44
      {
          $this->dropForeignKey('road_width_region', 'road_width');
          $this->dropForeignKey('road_width_road', 'road_width');
          $this->dropTable('road_width');
      }
  }