Blame view

migrations/m170721_135629_create_table_shops.php 964 Bytes
a874d14e   Anastasia   stock
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
43
44
45
46
  <?php
  
  use yii\db\Migration;
  
  class m170721_135629_create_table_shops extends Migration
  {
      public function safeUp()
      {
          $this->createTable('shop', [
              'id'            => $this->primaryKey(),
              'mode'          => $this->text(),
              'city_id'       => $this->integer(),
              'sort'      => $this->integer(),
              'status'     => $this->boolean()
                  ->defaultValue(true),
              'coords'    => $this->string(),
          ]);
  
          $this->addForeignKey(
              'city_city_id_fkey',
              'shop',
              'city_id',
              'city',
              'id',
              'CASCADE',
              'CASCADE'
          );
      }
  
      public function safeDown()
      {
          $this->dropForeignKey('city_city_id_fkey', 'shop');
          $this->dropTable('shop');
      }
  
  
      /*
      // Use up()/down() to run migration code without a transaction.
      public function up()
      {
  
      }
      */
  
  
  }