]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/blob
c89568454fe31c49415a9a3a72eac561ba5ba195
[erp24_rep/yii-erp24/.git] /
1 <?php
2
3 use yii\db\Migration;
4
5 class m250717_080913_add_is_marketplace_allowed_editing_fields_to_marketplace_orders_1c_statuses_table extends Migration
6 {
7     const TABLE_NAME = 'erp24.marketplace_order_1c_statuses';
8     /**
9      * {@inheritdoc}
10      */
11     public function safeUp()
12     {
13         $table = $this->db->schema->getTableSchema(self::TABLE_NAME);
14         if ($table === null) {
15             return;
16         }
17
18         if (!$this->db->schema->getTableSchema(self::TABLE_NAME, true)->getColumn('is_marketplace')) {
19             $this->addColumn(
20                 self::TABLE_NAME,
21                 'is_marketplace',
22                 $this->integer()->defaultValue(1)->comment('Метка заказа из маркетплейса'),
23             );
24         }
25         if (!$this->db->schema->getTableSchema(self::TABLE_NAME, true)->getColumn('allowed_editing')) {
26             $this->addColumn(
27                 self::TABLE_NAME,
28                 'allowed_editing',
29                 $this->integer()->defaultValue(1)->comment('Разрешено редактирование'),
30             );
31         }
32     }
33
34     /**
35      * {@inheritdoc}
36      */
37     public function safeDown()
38     {
39         if ($this->db->schema->getTableSchema(self::TABLE_NAME, true)->getColumn('is_marketplace')) {
40             $this->dropColumn(self::TABLE_NAME, 'is_marketplace');
41         }
42         if ($this->db->schema->getTableSchema(self::TABLE_NAME, true)->getColumn('allowed_editing')) {
43             $this->dropColumn(self::TABLE_NAME, 'allowed_editing');
44         }
45     }
46
47     /*
48     // Use up()/down() to run migration code without a transaction.
49     public function up()
50     {
51
52     }
53
54     public function down()
55     {
56         echo "m250717_080913_add_is_marketplace_allowed_editing_fields_to_marketplace_orders_1c_statuses_table cannot be reverted.\n";
57
58         return false;
59     }
60     */
61 }