Blame view

migrations/m160829_105345_add_default_languages.php 1.31 KB
08453431   Yarik   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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
  <?php
      
      use yii\db\Migration;
      
      class m160829_105345_add_default_languages extends Migration
      {
          
          public function up()
          {
              $this->batchInsert(
                  '{{%language}}',
                  [
                      'id',
                      'url',
                      'local',
                      'name',
                      'default',
                      'created_at',
                      'updated_at',
                  ],
                  [
                      [
                          1,
                          'en',
                          'en-EN',
                          'English',
                          0,
                          time(),
                          time(),
                      ],
                      [
                          2,
                          'ru',
                          'ru-RU',
                          'Русский',
                          1,
                          time(),
                          time(),
                      ],
                  ]
              );
          }
          
          public function down()
          {
              $this->delete(
                  '{{%language}}',
                  [
                      'id' => [
                          1,
                          2,
                      ],
                  ]
              );
          }
      }