]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Миграция
authorVladimir Fomichev <vladimir.fomichev@erp-flowers.ru>
Mon, 8 Sep 2025 13:12:48 +0000 (16:12 +0300)
committerVladimir Fomichev <vladimir.fomichev@erp-flowers.ru>
Mon, 8 Sep 2025 13:12:48 +0000 (16:12 +0300)
erp24/migrations/m250908_123600_create_matrix_bouquet_actuality_table.php [new file with mode: 0644]

diff --git a/erp24/migrations/m250908_123600_create_matrix_bouquet_actuality_table.php b/erp24/migrations/m250908_123600_create_matrix_bouquet_actuality_table.php
new file mode 100644 (file)
index 0000000..6da8741
--- /dev/null
@@ -0,0 +1,47 @@
+<?php
+
+use yii\db\Migration;
+
+/**
+ * Handles the creation of table `{{%matrix_bouquet_actuality}}`.
+ */
+class m250908_123600_create_matrix_bouquet_actuality_table extends Migration
+{
+    /**
+     * {@inheritdoc}
+     */
+    const TABLE_NAME = 'erp24.matrix_bouquet_actuality';
+    /**
+     * {@inheritdoc}
+     */
+    public function safeUp()
+    {
+        $tableSchema = $this->db->getTableSchema(self::TABLE_NAME);
+
+        if (!isset($tableSchema)) {
+            $this->createTable(self::TABLE_NAME, [
+                'id' => $this->primaryKey(),
+                'guid' => $this->string()->notNull()->comment('GUID товара из 1С'),
+                'bouquet_id' => $this->integer()->notNull()->comment('ID букета из bouquet_composition'),
+                'date_from' => $this->dateTime()->notNull()->comment('Дата и время начала активности'),
+                'date_to' => $this->dateTime()->null()->comment('Дата и время окончания активности'),
+                'is_archive' => $this->tinyInteger()->defaultValue(0)->comment('Признак архивного товара'),
+                'created_at' => $this->dateTime()->notNull()->comment('Дата создания'),
+                'updated_at' => $this->dateTime()->null()->comment('Дата обновления'),
+                'created_by' => $this->integer()->notNull()->comment('ИД создателя'),
+                'updated_by' => $this->integer()->null()->comment('ИД редактировавшего'),
+            ]);
+        }
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function safeDown()
+    {
+        $tableSchema = $this->db->getTableSchema(self::TABLE_NAME);
+        if (isset($tableSchema)) {
+            $this->dropTable(self::TABLE_NAME);
+        }
+    }
+}