]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Поле delivery_to - миграция
authorfomichev <vladimir.fomichev@erp-flowers.ru>
Wed, 23 Apr 2025 09:28:31 +0000 (12:28 +0300)
committerfomichev <vladimir.fomichev@erp-flowers.ru>
Wed, 23 Apr 2025 09:28:31 +0000 (12:28 +0300)
erp24/migrations/m250423_092430_add_delivery_to_column_to_marketplace_orders_table.php [new file with mode: 0644]

diff --git a/erp24/migrations/m250423_092430_add_delivery_to_column_to_marketplace_orders_table.php b/erp24/migrations/m250423_092430_add_delivery_to_column_to_marketplace_orders_table.php
new file mode 100644 (file)
index 0000000..48b2661
--- /dev/null
@@ -0,0 +1,39 @@
+<?php
+
+use yii\db\Migration;
+
+/**
+ * Handles adding columns to table `{{%marketplace_orders}}`.
+ */
+class m250423_092430_add_delivery_to_column_to_marketplace_orders_table extends Migration
+{
+    const TABLE_NAME = 'erp24.marketplace_orders';
+    /**
+     * {@inheritdoc}
+     */
+    public function safeUp()
+    {
+        $table = $this->db->schema->getTableSchema(self::TABLE_NAME);
+        if ($table === null) {
+            return;
+        }
+
+        if (!$this->db->schema->getTableSchema(self::TABLE_NAME, true)->getColumn('delivery_to')) {
+            $this->addColumn(
+                self::TABLE_NAME,
+                'delivery_to',
+                $this->text()->null()->comment('Сроки доставки заказа')
+            );
+        }
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function safeDown()
+    {
+        if ($this->db->schema->getTableSchema(self::TABLE_NAME, true)->getColumn('delivery_to')) {
+            $this->dropColumn(self::TABLE_NAME, 'delivery_to');
+        }
+    }
+}