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