Blame view

console/migrations/m160405_101056_create_slider_images.php 1.01 KB
4253cbec   root   first commit
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
  <?php

  

  use yii\db\Migration;

  

  /**

   * Handles the creation for table `slider_images`.

   */

  class m160405_101056_create_slider_images extends Migration

  {

      /**

       * @inheritdoc

       */

      public function up()

      {

          $this->createTable('slider_image', [

              'slider_image_id' => $this->primaryKey(),

              'slider_id' => $this->integer(),

              'image' => $this->string(255),

              'alt' => $this->string(255),

              'title' => $this->string(255),

              'url' => $this->string(255),

              'status' => $this->smallInteger(1),

              'sort' => $this->integer(6),

              'price' => $this->float(),

          ]);

          $this->addForeignKey('slider_slider_image_fk', 'slider_image', 'slider_id', 'slider', 'slider_id', 'CASCADE', 'CASCADE');

      }

  

      /**

       * @inheritdoc

       */

      public function down()

      {

          $this->dropForeignKey('slider_slider_image_fk', '{{%slider_image}}');

          $this->dropTable('slider_image');

      }

  }