]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Создана миграция для таблицы
authorfomichev <vladimir.fomichev@erp-flowers.ru>
Wed, 29 Jan 2025 15:02:46 +0000 (18:02 +0300)
committerfomichev <vladimir.fomichev@erp-flowers.ru>
Wed, 29 Jan 2025 15:02:46 +0000 (18:02 +0300)
erp24/migrations/m250129_144216_create_table_products_1c_nomenclature.php [new file with mode: 0644]

diff --git a/erp24/migrations/m250129_144216_create_table_products_1c_nomenclature.php b/erp24/migrations/m250129_144216_create_table_products_1c_nomenclature.php
new file mode 100644 (file)
index 0000000..39677ba
--- /dev/null
@@ -0,0 +1,67 @@
+<?php
+
+use yii\db\Migration;
+
+/**
+ * Class m250129_144216_create_table_products_1c_nomenclature
+ */
+class m250129_144216_create_table_products_1c_nomenclature extends Migration
+{
+    const TABLE_NAME = 'erp24.products_1c_nomenclature';
+    /**
+     * {@inheritdoc}
+     */
+    public function safeUp()
+    {
+        $tableSchema = $this->db->getTableSchema(self::TABLE_NAME);
+
+        if (!isset($tableSchema)) {
+            $this->createTable(self::TABLE_NAME, [
+                'id' => $this->string()->notNull()->comment('GUID - уникальный номер номенклатуры в 1С'),
+                'location' => $this->string()
+                    ->notNull()
+                    ->comment('расположение номенклатуры в системе 1С, т.е. путь до папки где храниться номенклатура'),
+                'name' => $this->string()
+                    ->notNull()
+                    ->comment('имя номенклатуры'),
+                'type_num' => $this->string()
+                    ->notNull()
+                    ->comment('Название вида номенклатуры из логического условия, без квадратных скобок.'),
+                'category' => $this->string()->notNull()->comment('Категория'),
+                'subcategory' => $this->string()->notNull()->comment('Подкатегория'),
+                'species' => $this->string()->comment('Вид'),
+                'sort' => $this->string()->comment('Сорт'),
+                'size' => $this->integer()->comment('Размер'),
+                'measure' => $this->string()->comment('Единица измерения'),
+                'color' => $this->string()->comment('Цвет'),
+                'PRIMARY KEY(id)',
+            ]);
+        }
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function safeDown()
+    {
+        $tableSchema = $this->db->getTableSchema(self::TABLE_NAME);
+        if (isset($tableSchema)) {
+            $this->dropTable(self::TABLE_NAME);
+        }
+    }
+
+    /*
+    // Use up()/down() to run migration code without a transaction.
+    public function up()
+    {
+
+    }
+
+    public function down()
+    {
+        echo "m250129_144216_create_table_products_1c_nomenclature cannot be reverted.\n";
+
+        return false;
+    }
+    */
+}