]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
feat(ERP-292): миграция таблицы products_1c_automark_predictions
authorfomichev <vladimir.fomichev@erp-flowers.ru>
Fri, 17 Apr 2026 13:25:56 +0000 (16:25 +0300)
committerfomichev <vladimir.fomichev@erp-flowers.ru>
Fri, 17 Apr 2026 13:25:56 +0000 (16:25 +0300)
erp24/migrations/m260417_000001_create_products_1c_automark_predictions.php [new file with mode: 0644]

diff --git a/erp24/migrations/m260417_000001_create_products_1c_automark_predictions.php b/erp24/migrations/m260417_000001_create_products_1c_automark_predictions.php
new file mode 100644 (file)
index 0000000..934b696
--- /dev/null
@@ -0,0 +1,43 @@
+<?php
+
+declare(strict_types=1);
+
+use yii\db\Migration;
+
+class m260417_000001_create_products_1c_automark_predictions extends Migration
+{
+    public function safeUp(): void
+    {
+        $this->createTable('products_1c_automark_predictions', [
+            'id'          => $this->primaryKey(),
+            'product_id'  => $this->string(36)->notNull(),
+            'category'    => $this->string(255)->null(),
+            'subcategory' => $this->string(255)->null(),
+            'species'     => $this->string(255)->null(),
+            'sort'        => $this->string(255)->null(),
+            'type'        => $this->string(255)->null(),
+            'size'        => $this->integer()->null(),
+            'color'       => $this->string(255)->null(),
+            'confidence'  => $this->float()->notNull(),
+            'method'      => $this->string(50)->notNull(),
+            'status'      => $this->smallInteger()->notNull()->defaultValue(0),
+            'approved_by' => $this->integer()->null(),
+            'created_at'  => $this->timestamp()->notNull()->defaultExpression('NOW()'),
+            'updated_at'  => $this->timestamp()->null(),
+        ]);
+
+        $this->createIndex('idx_automark_product_id', 'products_1c_automark_predictions', 'product_id');
+        $this->createIndex('idx_automark_status', 'products_1c_automark_predictions', 'status');
+        $this->addForeignKey(
+            'fk_automark_product',
+            'products_1c_automark_predictions', 'product_id',
+            'products_1c', 'id',
+            'CASCADE', 'CASCADE'
+        );
+    }
+
+    public function safeDown(): void
+    {
+        $this->dropTable('products_1c_automark_predictions');
+    }
+}