--- /dev/null
+<?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;
+ }
+ */
+}