5 class m250718_093101_add_cancelled_order_source_date_fields_to_marketplace_orders_table extends Migration
7 const TABLE_NAME = 'erp24.marketplace_orders';
11 public function safeUp()
13 $table = $this->db->schema->getTableSchema(self::TABLE_NAME);
14 if ($table === null) {
18 if (!$this->db->schema->getTableSchema(self::TABLE_NAME, true)->getColumn('cancelled_order_source')) {
21 'cancelled_order_source',
22 $this->string()->null()->comment('Источник отмененного заказа')
25 if (!$this->db->schema->getTableSchema(self::TABLE_NAME, true)->getColumn('cancelled_order_date')) {
28 'cancelled_order_date',
29 $this->timestamp()->null()->comment('Время отправки отмененного заказа в 1С')
37 public function safeDown()
39 if ($this->db->schema->getTableSchema(self::TABLE_NAME, true)->getColumn('cancelled_order_source')) {
40 $this->dropColumn(self::TABLE_NAME, 'cancelled_order_source');
42 if ($this->db->schema->getTableSchema(self::TABLE_NAME, true)->getColumn('cancelled_order_date')) {
43 $this->dropColumn(self::TABLE_NAME, 'cancelled_order_date');
48 // Use up()/down() to run migration code without a transaction.
54 public function down()
56 echo "m250718_093101_add_cancelled_order_source_date_fields_to_marketplace_orders_table cannot be reverted.\n";