Blame view

console/migrations/m160804_100209_create_article_to_rating.php 678 Bytes
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
  <?php
  
  use yii\db\Migration;
  
  class m160804_100209_create_article_to_rating extends Migration
  {
      public function up()
      {
          $this->createTable('article_to_rating', [
              'article_to_rating_id' => $this->primaryKey(),
              'articles_id' => $this->integer()->notNull(),
              'value' => $this->float()->defaultValue(0),
          ]);
      
          $this->addForeignKey('article_to_rating_article', 'article_to_rating', 'articles_id', 'articles', 'id', 'CASCADE', 'CASCADE');
      }
  
      public function down()
      {
          $this->dropForeignKey('article_to_rating_article', 'article_to_rating');
          $this->dropTable('article_to_rating');
      }
  }