Blame view

console/migrations/m211118_133135_create_tile_table.php 851 Bytes
e9653064   Volodymyr   add tiles
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
32
33
34
35
36
37
38
39
40
41
42
  <?php
  
  use yii\db\Migration;
  
  /**
   * Handles the creation of table `tile`.
   */
  class m211118_133135_create_tile_table extends Migration
  {
      /**
       * @inheritdoc
       */
      public function up()
      {
          $this->createTable('tile', [
              'id' => $this->primaryKey(),
              'status'             => $this->boolean(),
              'sort'             => $this->smallInteger(),
              'image_id'        => $this->integer(),
          ]);
          $this->addForeignKey(
              'fk-tile-image_id',
              'tile',
              'image_id',
              'ImageManager',
              'id',
              'CASCADE'
          );
      }
  
      /**
       * @inheritdoc
       */
      public function down()
      {
          $this->dropForeignKey(
              'fk-tile-image_id',
              'tile'
          );
          $this->dropTable('tile');
      }
  }