]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Миграция с доп полями products_1c
authorfomichev <vladimir.fomichev@erp-flowers.ru>
Tue, 26 Nov 2024 15:41:18 +0000 (18:41 +0300)
committerfomichev <vladimir.fomichev@erp-flowers.ru>
Tue, 26 Nov 2024 15:41:18 +0000 (18:41 +0300)
erp24/migrations/m241126_152940_add_fields_to_products_1c.php [new file with mode: 0644]

diff --git a/erp24/migrations/m241126_152940_add_fields_to_products_1c.php b/erp24/migrations/m241126_152940_add_fields_to_products_1c.php
new file mode 100644 (file)
index 0000000..d3b55f2
--- /dev/null
@@ -0,0 +1,48 @@
+<?php
+
+use yii\db\Migration;
+
+/**
+ * Class m241126_152940_add_fields_to_products_1c
+ */
+class m241126_152940_add_fields_to_products_1c extends Migration
+{
+
+    const TABLE_NAME = 'erp24.products_1c';
+    /**
+     * {@inheritdoc}
+     */
+    public function safeUp()
+    {
+        $this->addColumn(self::TABLE_NAME, 'product_type', $this->string()->null()->comment('Вид номенклатуры'));
+        $this->addColumn(self::TABLE_NAME, 'country_of_origin', $this->string()->null()->comment('Страна происхождения'));
+        $this->addColumn(self::TABLE_NAME, 'manufacturer', $this->string()->null()->comment('Производитель'));
+        $this->addColumn(self::TABLE_NAME, 'brand', $this->string()->null()->comment('Бренд'));
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function safeDown()
+    {
+        $this->dropColumn(self::TABLE_NAME, 'product_type');
+        $this->dropColumn(self::TABLE_NAME, 'country_of_origin');
+        $this->dropColumn(self::TABLE_NAME, 'manufacturer');
+        $this->dropColumn(self::TABLE_NAME, 'brand');
+    }
+
+    /*
+    // Use up()/down() to run migration code without a transaction.
+    public function up()
+    {
+
+    }
+
+    public function down()
+    {
+        echo "m241126_152940_add_fields_to_products_1c cannot be reverted.\n";
+
+        return false;
+    }
+    */
+}